Last active
January 26, 2017 13:24
-
-
Save andrealmar/67cc2da1e421e063b08ec12abf1cdb40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| import os | |
| from time import time | |
| from download import setup_download_dir, get_links, download_link | |
| logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') | |
| logger = logging.getLogger(__name__) | |
| def main(): | |
| ts = time() | |
| client_id = os.getenv('IMGUR_CLIENT_ID') | |
| if not client_id: | |
| raise Exception("Couldn't find IMGUR_CLIENT_ID environment variable!") | |
| download_dir = setup_download_dir() | |
| links = get_links(client_id) | |
| for link in links: | |
| download_link(download_dir, link) | |
| logging.info('Took %s seconds', time() - ts) | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment