From 5dc9be47cb09b5ad7cbae224e596b8e40e387c27 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 18 Aug 2016 09:58:07 +0200 Subject: [PATCH] Make instaloader usable as package This commit allows doing `import instaloader` when instaloader is located in a subdirectory "instaloader". This makes it easier to use instaloader e.g. when it is imported using git submodules feature. --- .gitignore | 1 + __init__.py | 4 ++++ instaloader.py | 10 ++++++++++ 3 files changed, 15 insertions(+) create mode 100644 .gitignore create mode 100644 __init__.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..987ed2d --- /dev/null +++ b/__init__.py @@ -0,0 +1,4 @@ +"""Simple downloader to fetch all Instagram pics and captions from a given profile""" + +# pylint:disable=wildcard-import +from .instaloader import * diff --git a/instaloader.py b/instaloader.py index 2e258df..210717f 100755 --- a/instaloader.py +++ b/instaloader.py @@ -13,6 +13,16 @@ else: win_unicode_console.enable() WINUNICODE = True +# List of public objects which are provided by `import instaloader`. +__all__ = ['BadCredentialsException', 'ConnectionException', 'InstaloaderException', + 'LoginRequiredException', 'NonfatalException', 'PrivateProfileNotFollowedException', + 'ProfileHasNoPicsException', 'ProfileNotExistsException', 'check_id', 'copy_session', + 'default_http_header', 'download', 'download_pic', 'download_profilepic', + 'download_profiles', 'epoch_to_string', 'get_anonymous_session', + 'get_default_session_filename', 'get_file_extension', 'get_followees', 'get_id_by_username', + 'get_json', 'get_last_id', 'get_logged_in_session', 'get_session', 'get_username_by_id', + 'load_session', 'log', 'main', 'save_caption', 'save_session', 'test_login'] + class InstaloaderException(Exception): """Base exception for this script""" pass