From 82e7b19d6d1b6b7d43e30f3e84c0c74557e595f5 Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Sun, 26 Jul 2020 18:00:37 +0200 Subject: [PATCH] docs: Split as-module into smaller documents --- docs/as-module.rst | 168 ++--------------------------- docs/module/exceptions.rst | 49 +++++++++ docs/module/instaloader.rst | 10 ++ docs/module/instaloadercontext.rst | 24 +++++ docs/module/nodeiterator.rst | 31 ++++++ docs/module/structures.rst | 82 ++++++++++++++ 6 files changed, 205 insertions(+), 159 deletions(-) create mode 100644 docs/module/exceptions.rst create mode 100644 docs/module/instaloader.rst create mode 100644 docs/module/instaloadercontext.rst create mode 100644 docs/module/nodeiterator.rst create mode 100644 docs/module/structures.rst diff --git a/docs/as-module.rst b/docs/as-module.rst index 52e5b77..4a0d820 100644 --- a/docs/as-module.rst +++ b/docs/as-module.rst @@ -12,9 +12,6 @@ Python Module :mod:`instaloader` .. highlight:: python -.. contents:: - :backlinks: none - Instaloader exposes its internally used methods and structures as a Python module, making it a **powerful and intuitive Python API for Instagram**, allowing to further customize obtaining media and metadata. @@ -94,164 +91,17 @@ metadata of a Profile. :class:`Profile` instances can be created with: - :attr:`PostComment.owner` attribute for comment in :meth:`Post.get_comments` Profile of a Post comment. -A reference of the many methods provided by the :mod:`instaloader` module is -provided in the remainder of this document. - For a list of real code examples using the Instaloader module for advanced tasks, see :ref:`codesnippets`. -``Instaloader`` (Main Class) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The reference of the many classes provided by the :mod:`instaloader` module is +divided into the following subsections. -.. autoclass:: Instaloader - :no-show-inheritance: +.. toctree:: + :maxdepth: 2 -Instagram Structures -^^^^^^^^^^^^^^^^^^^^ - -Posts -""""" - -.. autoclass:: Post - :no-show-inheritance: - -Additionally, the following trivial structures are defined: - -.. autoclass:: PostSidecarNode - :no-show-inheritance: - -.. autoclass:: PostComment - :no-show-inheritance: - -.. autoclass:: PostCommentAnswer - :no-show-inheritance: - -.. autoclass:: PostLocation - :no-show-inheritance: - -User Stories -"""""""""""" - -.. autoclass:: Story - :no-show-inheritance: - -.. autoclass:: StoryItem - :no-show-inheritance: - -Highlights -"""""""""" - -.. autoclass:: Highlight - :no-show-inheritance: - :inherited-members: - - Bases: :class:`Story` - - .. versionadded:: 4.1 - -Profiles -"""""""" - -.. autoclass:: Profile - :no-show-inheritance: - -Hashtags -"""""""" - -.. autoclass:: Hashtag - :no-show-inheritance: - - .. versionadded:: 4.4 - -TopSearchResults -"""""""""""""""" - -.. autoclass:: TopSearchResults - :no-show-inheritance: - - .. versionadded:: 4.3 - -Loading and Saving -"""""""""""""""""" - -:class:`Post`, :class:`StoryItem`, :class:`Profile` and :class:`Hashtag` can be saved and loaded -to/from JSON files. - -.. autofunction:: load_structure_from_file - -.. autofunction:: save_structure_to_file - -Exceptions -^^^^^^^^^^ - -.. currentmodule:: instaloader.exceptions - -.. autoexception:: InstaloaderException - :no-show-inheritance: - -.. autoexception:: ConnectionException - -.. currentmodule:: instaloader - -.. autoexception:: QueryReturnedBadRequestException - -.. autoexception:: QueryReturnedForbiddenException - -.. autoexception:: ProfileNotExistsException - -.. autoexception:: ProfileHasNoPicsException - -.. autoexception:: PrivateProfileNotFollowedException - -.. autoexception:: LoginRequiredException - -.. autoexception:: TwoFactorAuthRequiredException - - .. versionadded:: 4.2 - -.. autoexception:: InvalidArgumentException - -.. autoexception:: BadResponseException - -.. autoexception:: BadCredentialsException - -.. autoexception:: PostChangedException - -.. autoexception:: QueryReturnedNotFoundException - - .. versionchanged:: 4.3 - QueryReturnedNotFoundException now inherits ConnectionException - to retry on 404 errors. - - -.. autoexception:: TooManyRequestsException - -Resumable Iterations -^^^^^^^^^^^^^^^^^^^^ - -.. versionadded:: 4.5 - -.. autoclass:: NodeIterator - :no-show-inheritance: - -.. autoclass:: FrozenNodeIterator - :no-show-inheritance: - -.. autofunction:: resumable_iteration - -``InstaloaderContext`` (Low-level functions) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -``InstaloaderContext`` -"""""""""""""""""""""" - -.. autoclass:: InstaloaderContext - :no-show-inheritance: - -``RateController`` -"""""""""""""""""" - -.. autoclass:: RateController - :no-show-inheritance: - - .. versionadded:: 4.5 + module/instaloader + module/structures + module/nodeiterator + module/instaloadercontext + module/exceptions diff --git a/docs/module/exceptions.rst b/docs/module/exceptions.rst new file mode 100644 index 0000000..e29aa69 --- /dev/null +++ b/docs/module/exceptions.rst @@ -0,0 +1,49 @@ +Exceptions +^^^^^^^^^^ + +.. module:: instaloader + :noindex: + +.. highlight:: python + +.. currentmodule:: instaloader.exceptions + +.. autoexception:: InstaloaderException + :no-show-inheritance: + +.. autoexception:: ConnectionException + +.. currentmodule:: instaloader + +.. autoexception:: QueryReturnedBadRequestException + +.. autoexception:: QueryReturnedForbiddenException + +.. autoexception:: ProfileNotExistsException + +.. autoexception:: ProfileHasNoPicsException + +.. autoexception:: PrivateProfileNotFollowedException + +.. autoexception:: LoginRequiredException + +.. autoexception:: TwoFactorAuthRequiredException + + .. versionadded:: 4.2 + +.. autoexception:: InvalidArgumentException + +.. autoexception:: BadResponseException + +.. autoexception:: BadCredentialsException + +.. autoexception:: PostChangedException + +.. autoexception:: QueryReturnedNotFoundException + + .. versionchanged:: 4.3 + QueryReturnedNotFoundException now inherits ConnectionException + to retry on 404 errors. + + +.. autoexception:: TooManyRequestsException diff --git a/docs/module/instaloader.rst b/docs/module/instaloader.rst new file mode 100644 index 0000000..d744e25 --- /dev/null +++ b/docs/module/instaloader.rst @@ -0,0 +1,10 @@ +``Instaloader`` (Main Class) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. module:: instaloader + :noindex: + +.. highlight:: python + +.. autoclass:: Instaloader + :no-show-inheritance: \ No newline at end of file diff --git a/docs/module/instaloadercontext.rst b/docs/module/instaloadercontext.rst new file mode 100644 index 0000000..5afd633 --- /dev/null +++ b/docs/module/instaloadercontext.rst @@ -0,0 +1,24 @@ +``InstaloaderContext`` (Low-level functions) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. module:: instaloader + :noindex: + +.. highlight:: python + +.. contents:: + :backlinks: none + +``InstaloaderContext`` +"""""""""""""""""""""" + +.. autoclass:: InstaloaderContext + :no-show-inheritance: + +``RateController`` +"""""""""""""""""" + +.. autoclass:: RateController + :no-show-inheritance: + + .. versionadded:: 4.5 diff --git a/docs/module/nodeiterator.rst b/docs/module/nodeiterator.rst new file mode 100644 index 0000000..edd3e46 --- /dev/null +++ b/docs/module/nodeiterator.rst @@ -0,0 +1,31 @@ +Resumable Iterations +^^^^^^^^^^^^^^^^^^^^ + +.. module:: instaloader + :noindex: + +.. highlight:: python + +.. contents:: + :backlinks: none + +For many download targets, Instaloader is able to resume a +previously-interrupted iteration. It provides an interruptable +Iterator :class:`NodeIterator` and a context manager +:func:`resumable_iteration`, which we both present here. + +.. versionadded:: 4.5 + +``NodeIterator`` +"""""""""""""""" + +.. autoclass:: NodeIterator + :no-show-inheritance: + +.. autoclass:: FrozenNodeIterator + :no-show-inheritance: + +``resumable_iteration`` +""""""""""""""""""""""" + +.. autofunction:: resumable_iteration \ No newline at end of file diff --git a/docs/module/structures.rst b/docs/module/structures.rst new file mode 100644 index 0000000..db366c1 --- /dev/null +++ b/docs/module/structures.rst @@ -0,0 +1,82 @@ +Instagram Structures +^^^^^^^^^^^^^^^^^^^^ + +.. module:: instaloader + :noindex: + +.. highlight:: python + +.. contents:: + :backlinks: none + +Posts +""""" + +.. autoclass:: Post + :no-show-inheritance: + +Additionally, the following trivial structures are defined: + +.. autoclass:: PostSidecarNode + :no-show-inheritance: + +.. autoclass:: PostComment + :no-show-inheritance: + +.. autoclass:: PostCommentAnswer + :no-show-inheritance: + +.. autoclass:: PostLocation + :no-show-inheritance: + +User Stories +"""""""""""" + +.. autoclass:: Story + :no-show-inheritance: + +.. autoclass:: StoryItem + :no-show-inheritance: + +Highlights +"""""""""" + +.. autoclass:: Highlight + :no-show-inheritance: + :inherited-members: + + Bases: :class:`Story` + + .. versionadded:: 4.1 + +Profiles +"""""""" + +.. autoclass:: Profile + :no-show-inheritance: + +Hashtags +"""""""" + +.. autoclass:: Hashtag + :no-show-inheritance: + + .. versionadded:: 4.4 + +TopSearchResults +"""""""""""""""" + +.. autoclass:: TopSearchResults + :no-show-inheritance: + + .. versionadded:: 4.3 + +Loading and Saving +"""""""""""""""""" + +:class:`Post`, :class:`StoryItem`, :class:`Profile`, :class:`Hashtag` and +:class:`FrozenNodeIterator` can be saved and loaded to/from JSON files. + +.. autofunction:: load_structure_from_file + +.. autofunction:: save_structure_to_file