diff --git a/.travis.yml b/.travis.yml index eb496f0..0ebab28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: - pip install -r docs/requirements.txt script: - python3 -m pylint -r n -d bad-whitespace,missing-docstring,too-many-arguments,locally-disabled,line-too-long,too-many-public-methods,too-many-lines,too-many-instance-attributes,too-many-locals,too-many-branches,too-many-statements,inconsistent-return-statements,invalid-name,wildcard-import,unused-wildcard-import instaloader - - make -C docs html + - make -C docs html SPHINXOPTS="-W -n" deploy: - provider: pypi user: aandergr diff --git a/docs/as-module.rst b/docs/as-module.rst index e838901..636b307 100644 --- a/docs/as-module.rst +++ b/docs/as-module.rst @@ -73,7 +73,7 @@ metadata of a Profile. :class:`Profile` instances can be created with: profile = Profile.from_username(L.context, USERNAME) -- :meth:`Profile_from_userid` +- :meth:`Profile.from_id` given its User ID. This allows to easily lookup a Profile's username given its ID:: @@ -116,15 +116,12 @@ Additionally, the following trivial structures are defined: .. autoclass:: PostSidecarNode :no-show-inheritance: - :no-members: .. autoclass:: PostComment :no-show-inheritance: - :no-members: .. autoclass:: PostLocation :no-show-inheritance: - :no-members: User Stories """""""""""" @@ -154,9 +151,15 @@ to/from JSON files. Exceptions ^^^^^^^^^^ +.. currentmodule:: instaloader.exceptions + .. autoexception:: InstaloaderException :no-show-inheritance: +.. autoexception:: ConnectionException + +.. currentmodule:: instaloader + .. autoexception:: QueryReturnedBadRequestException .. autoexception:: QueryReturnedNotFoundException @@ -177,8 +180,6 @@ Exceptions .. autoexception:: BadCredentialsException -.. autoexception:: ConnectionException - .. autoexception:: TooManyRequestsException ``InstaloaderContext`` (Low-level functions) diff --git a/instaloader/instaloader.py b/instaloader/instaloader.py index c198a76..0082310 100644 --- a/instaloader/instaloader.py +++ b/instaloader/instaloader.py @@ -91,6 +91,10 @@ class Instaloader: txt file. :param storyitem_metadata_txt_pattern: :option:`--storyitem-metadata-txt`, default is empty (=none) :param max_connection_attempts: :option:`--max-connection-attempts` + + .. attribute:: context + + The associated :class:`InstaloaderContext` with low-level communication functions and logging. """ def __init__(self, diff --git a/instaloader/instaloadercontext.py b/instaloader/instaloadercontext.py index f8a86c3..321339c 100644 --- a/instaloader/instaloadercontext.py +++ b/instaloader/instaloadercontext.py @@ -156,7 +156,7 @@ class InstaloaderContext: pickle.dump(requests.utils.dict_from_cookiejar(self._session.cookies), sessionfile) def load_session_from_file(self, username, sessionfile): - """Not meant to be used directly, use :meth:`Instaloader.load_session_to_file`.""" + """Not meant to be used directly, use :meth:`Instaloader.load_session_from_file`.""" session = requests.Session() session.cookies = requests.utils.cookiejar_from_dict(pickle.load(sessionfile)) session.headers.update(self._default_http_header()) diff --git a/instaloader/structures.py b/instaloader/structures.py index 4ae6592..32bb645 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -12,8 +12,24 @@ from .instaloadercontext import InstaloaderContext PostSidecarNode = namedtuple('PostSidecarNode', ['is_video', 'display_url', 'video_url']) +PostSidecarNode.__doc__ = "Item of a Sidecar Post." +PostSidecarNode.is_video.__doc__ = "Whether this node is a video." +PostSidecarNode.display_url.__doc__ = "URL of image or video thumbnail." +PostSidecarNode.video_url.__doc__ = "URL of video or None." + PostComment = namedtuple('PostComment', ['id', 'created_at_utc', 'text', 'owner']) +PostComment.id.__doc__ = "ID number of comment." +PostComment.created_at_utc.__doc__ = ":class:`~datetime.datetime` when comment was created (UTC)." +PostComment.text.__doc__ = "Comment text." +PostComment.owner.__doc__ = "Owner :class:`Profile` of the comment." + PostLocation = namedtuple('PostLocation', ['id', 'name', 'slug', 'has_public_page', 'lat', 'lng']) +PostLocation.id.__doc__ = "ID number of location." +PostLocation.name.__doc__ = "Location name." +PostLocation.slug.__doc__ = "URL friendly variant of location name." +PostLocation.has_public_page.__doc__ = "Whether location has a public page." +PostLocation.lat.__doc__ = "Latitude (:class:`float`)." +PostLocation.lng.__doc__ = "Longitude (:class:`float`)." class Post: @@ -758,7 +774,7 @@ class Story: def unique_id(self) -> str: """ This ID only equals amongst :class:`Story` instances which have the same owner and the same set of - :class:`StoryItem`s. For all other :class:`Story` instances this ID is different. + :class:`StoryItem`. For all other :class:`Story` instances this ID is different. """ if not self._unique_id: id_list = [item.mediaid for item in self.get_items()] @@ -841,7 +857,7 @@ def save_structure_to_file(structure: JsonExportable, filename: str) -> None: def load_structure_from_file(context: InstaloaderContext, filename: str) -> JsonExportable: """Loads a :class:`Post`, :class:`Profile` or :class:`StoryItem` from a '.json' or '.json.xz' file that - has been saved by :func:`save_structure_from_file`. + has been saved by :func:`save_structure_to_file`. :param context: :attr:`Instaloader.context` linked to the new object, used for additional queries if neccessary. :param filename: Filename, ends in '.json' or '.json.xz'