From: Harmon Date: Fri, 25 Feb 2022 16:05:16 +0000 (-0600) Subject: Organize documentation arrangement X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c5310d11cd62ea2aeb69bb546d0d3682dd4bc739;p=tweepy.git Organize documentation arrangement Improve index / table of contents categorization --- diff --git a/docs/api.rst b/docs/api.rst index 500a823..34116bf 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -4,9 +4,9 @@ .. include:: parameters.rst -************************************************** -:class:`tweepy.API` --- Twitter API v1.1 Reference -************************************************** +************ +:class:`API` +************ .. autoclass:: API diff --git a/docs/asyncstream.rst b/docs/asyncstream.rst index dd9025b..da4123a 100644 --- a/docs/asyncstream.rst +++ b/docs/asyncstream.rst @@ -2,9 +2,9 @@ .. currentmodule:: tweepy.asynchronous -************************************************************************** -:class:`tweepy.asynchronous.AsyncStream` --- Asynchronous Stream Reference -************************************************************************** +******************** +:class:`AsyncStream` +******************** .. autoclass:: AsyncStream :members: diff --git a/docs/client.rst b/docs/client.rst index 75865ea..0f20459 100644 --- a/docs/client.rst +++ b/docs/client.rst @@ -2,9 +2,9 @@ .. currentmodule:: tweepy -*************************************************** -:class:`tweepy.Client` --- Twitter API v2 Reference -*************************************************** +*************** +:class:`Client` +*************** .. autoclass:: Client diff --git a/docs/index.rst b/docs/index.rst index d3e9d65..fe1bfb6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,17 +14,37 @@ Contents: install.rst getting_started.rst authentication.rst + logging.rst + streaming.rst + +.. toctree:: + :caption: Twitter API v1.1 Reference + api.rst - client.rst - models.rst stream.rst - streamingclient.rst asyncstream.rst exceptions.rst + v1_models.rst + v1_pagination.rst + +.. toctree:: + :maxdepth: 1 + extended_tweets.rst - logging.rst - pagination.rst - streaming.rst + +.. toctree:: + :caption: Twitter API v2 Reference + + client.rst + streamingclient.rst + exceptions.rst + v2_models.rst + v2_pagination.rst + +.. toctree:: + :caption: Meta + :maxdepth: 2 + changelog.md development.rst examples.rst diff --git a/docs/models.rst b/docs/models.rst deleted file mode 100644 index a40269b..0000000 --- a/docs/models.rst +++ /dev/null @@ -1,102 +0,0 @@ -.. _models_reference: - -**************** -Models Reference -**************** - -.. tabs:: - - .. group-tab:: API v1.1 - - .. class:: tweepy.models.BoundingBox - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/geo#bounding-box - - .. class:: tweepy.models.DirectMessage - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/guides/message-create-object - - .. class:: tweepy.models.Friendship - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show#example-response - - .. class:: tweepy.models.List - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-show#example-response - - .. class:: tweepy.models.Media - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/entities#media - - .. class:: tweepy.models.Place - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/geo#place - - .. class:: tweepy.models.Relationship - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup#example-response - - .. class:: tweepy.models.SavedSearch - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-show-id#example-response - - .. class:: tweepy.models.SearchResults - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets#example-response - - .. class:: tweepy.models.Status - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/tweet - - .. class:: tweepy.models.User - - :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/user - - .. group-tab:: API v2 - - .. versionadded:: 4.0 - - .. class:: tweepy.List - - .. versionadded:: 4.4 - - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/lists - - .. class:: tweepy.Media - - .. versionchanged:: 4.5 - Added ``url`` field - - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media - - .. class:: tweepy.Place - - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place - - .. class:: tweepy.Poll - - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll - - .. class:: tweepy.ReferencedTweet - - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet - - .. class:: tweepy.Space - - .. versionadded:: 4.1 - - .. versionchanged:: 4.4 - Added ``ended_at`` and ``topic_ids`` fields - - .. versionchanged:: 4.6 - Added ``subscriber_count`` field - - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/space - - .. class:: tweepy.Tweet - - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet - - .. class:: tweepy.User - - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user diff --git a/docs/pagination.rst b/docs/pagination.rst deleted file mode 100644 index 48dae16..0000000 --- a/docs/pagination.rst +++ /dev/null @@ -1,57 +0,0 @@ -.. _pagination_guide: - -.. currentmodule:: tweepy - -********** -Pagination -********** - -.. tabs:: - - .. group-tab:: API v1.1 - - .. autoclass:: Cursor - :members: - - .. group-tab:: API v2 - - .. autoclass:: Paginator - :members: - -Example -======= - -.. tabs:: - - .. group-tab:: API v1.1 - - :: - - import tweepy - - auth = tweepy.OAuth2AppHandler("Consumer Key here", "Consumer Secret here") - api = tweepy.API(auth) - - for status in tweepy.Cursor(api.search_tweets, "Tweepy", - count=100).items(250): - print(status.id) - - for page in tweepy.Cursor(api.get_followers, screen_name="TwitterDev", - count=200).pages(5): - print(len(page)) - - .. group-tab:: API v2 - - :: - - import tweepy - - client = tweepy.Client("Bearer Token here") - - for response in tweepy.Paginator(client.get_users_followers, 2244994945, - max_results=1000, limit=5): - print(response.meta) - - for tweet in tweepy.Paginator(client.search_recent_tweets, "Tweepy", - max_results=100).flatten(limit=250): - print(tweet.id) diff --git a/docs/stream.rst b/docs/stream.rst index 73b18ef..c92a12c 100644 --- a/docs/stream.rst +++ b/docs/stream.rst @@ -2,9 +2,9 @@ .. currentmodule:: tweepy -***************************************************** -:class:`tweepy.Stream` --- Twitter API v1.1 Reference -***************************************************** +*************** +:class:`Stream` +*************** .. autoclass:: Stream :members: diff --git a/docs/streamingclient.rst b/docs/streamingclient.rst index 048f96b..06e0c7c 100644 --- a/docs/streamingclient.rst +++ b/docs/streamingclient.rst @@ -2,9 +2,9 @@ .. currentmodule:: tweepy -************************************************************ -:class:`tweepy.StreamingClient` --- Twitter API v2 Reference -************************************************************ +************************ +:class:`StreamingClient` +************************ .. autoclass:: StreamingClient :members: diff --git a/docs/v1_models.rst b/docs/v1_models.rst new file mode 100644 index 0000000..5e4706b --- /dev/null +++ b/docs/v1_models.rst @@ -0,0 +1,49 @@ +.. _v1_models_reference: + +****** +Models +****** + +.. class:: tweepy.models.BoundingBox + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/geo#bounding-box + +.. class:: tweepy.models.DirectMessage + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/guides/message-create-object + +.. class:: tweepy.models.Friendship + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show#example-response + +.. class:: tweepy.models.List + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-show#example-response + +.. class:: tweepy.models.Media + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/entities#media + +.. class:: tweepy.models.Place + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/geo#place + +.. class:: tweepy.models.Relationship + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup#example-response + +.. class:: tweepy.models.SavedSearch + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-show-id#example-response + +.. class:: tweepy.models.SearchResults + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets#example-response + +.. class:: tweepy.models.Status + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/tweet + +.. class:: tweepy.models.User + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/user diff --git a/docs/v1_pagination.rst b/docs/v1_pagination.rst new file mode 100644 index 0000000..37adbda --- /dev/null +++ b/docs/v1_pagination.rst @@ -0,0 +1,28 @@ +.. _v1_pagination_guide: + +.. currentmodule:: tweepy + +********** +Pagination +********** + +.. autoclass:: Cursor + :members: + +Example +======= + +:: + + import tweepy + + auth = tweepy.OAuth2AppHandler("Consumer Key here", "Consumer Secret here") + api = tweepy.API(auth) + + for status in tweepy.Cursor(api.search_tweets, "Tweepy", + count=100).items(250): + print(status.id) + + for page in tweepy.Cursor(api.get_followers, screen_name="TwitterDev", + count=200).pages(5): + print(len(page)) diff --git a/docs/v2_models.rst b/docs/v2_models.rst new file mode 100644 index 0000000..0923791 --- /dev/null +++ b/docs/v2_models.rst @@ -0,0 +1,52 @@ +.. _v2_models_reference: + +****** +Models +****** + +.. versionadded:: 4.0 + +.. class:: tweepy.List + + .. versionadded:: 4.4 + + :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/lists + +.. class:: tweepy.Media + + .. versionchanged:: 4.5 + Added ``url`` field + + :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media + +.. class:: tweepy.Place + + :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place + +.. class:: tweepy.Poll + + :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll + +.. class:: tweepy.ReferencedTweet + + :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet + +.. class:: tweepy.Space + + .. versionadded:: 4.1 + + .. versionchanged:: 4.4 + Added ``ended_at`` and ``topic_ids`` fields + + .. versionchanged:: 4.6 + Added ``subscriber_count`` field + + :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/space + +.. class:: tweepy.Tweet + + :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet + +.. class:: tweepy.User + + :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user diff --git a/docs/v2_pagination.rst b/docs/v2_pagination.rst new file mode 100644 index 0000000..0146515 --- /dev/null +++ b/docs/v2_pagination.rst @@ -0,0 +1,27 @@ +.. _v2_pagination_guide: + +.. currentmodule:: tweepy + +********** +Pagination +********** + +.. autoclass:: Paginator + :members: + +Example +======= + +:: + + import tweepy + + client = tweepy.Client("Bearer Token here") + + for response in tweepy.Paginator(client.get_users_followers, 2244994945, + max_results=1000, limit=5): + print(response.meta) + + for tweet in tweepy.Paginator(client.search_recent_tweets, "Tweepy", + max_results=100).flatten(limit=250): + print(tweet.id)