Use sphinx-tabs for Models Reference and Pagination documentation
authorHarmon <Harmon758@gmail.com>
Sun, 26 Sep 2021 07:39:15 +0000 (02:39 -0500)
committerHarmon <Harmon758@gmail.com>
Sun, 26 Sep 2021 07:39:15 +0000 (02:39 -0500)
docs/conf.py
docs/models.rst
docs/pagination.rst
docs/requirements.txt

index 160c289bdd6415f6901991a3f70d73ff057e5459..fa7f64405a4b69f04c80201ddd5ed5d81d0a48d5 100644 (file)
@@ -30,7 +30,8 @@ extensions = [
   'sphinx.ext.autodoc',
   'sphinx.ext.autosectionlabel',
   'sphinx.ext.intersphinx',
-  'sphinx.ext.napoleon'
+  'sphinx.ext.napoleon',
+  'sphinx_tabs.tabs'
 ]
 
 hoverxref_auto_ref = True
index 7c04db9a72a42d999bd6996c6794eac74e95a9d1..650ea631397946df4c01ad544aea386906624e31 100644 (file)
@@ -4,76 +4,76 @@
 Models Reference
 ****************
 
-API v1.1
-========
+.. tabs::
 
-.. class:: tweepy.models.BoundingBox
+   .. group-tab:: API v1.1
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/geo#bounding-box
+      .. class:: tweepy.models.BoundingBox
 
-.. class:: tweepy.models.DirectMessage
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/geo#bounding-box
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/guides/message-create-object
+      .. class:: tweepy.models.DirectMessage
 
-.. class:: tweepy.models.Friendship
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/guides/message-create-object
 
-   :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.Friendship
 
-.. class:: tweepy.models.List
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show#example-response
 
-   :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.List
 
-.. class:: tweepy.models.Media
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-show#example-response
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/entities#media
+      .. class:: tweepy.models.Media
 
-.. class:: tweepy.models.Place
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/entities#media
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/geo#place
+      .. class:: tweepy.models.Place
 
-.. class:: tweepy.models.Relationship
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/geo#place
 
-   :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.Relationship
 
-.. class:: tweepy.models.SavedSearch
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup#example-response
 
-   :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.SavedSearch
 
-.. class:: tweepy.models.SearchResults
+         :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
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets#example-response
+      .. class:: tweepy.models.SearchResults
 
-.. class:: tweepy.models.Status
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets#example-response
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/tweet
+      .. class:: tweepy.models.Status
 
-.. class:: tweepy.models.User
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/tweet
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/user
+      .. class:: tweepy.models.User
 
-API v2
-======
+         :reference: https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/user
 
-.. class:: tweepy.Media
+   .. group-tab:: API v2
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media
+      .. class:: tweepy.Media
 
-.. class:: tweepy.Place
+         :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place
+      .. class:: tweepy.Place
 
-.. class:: tweepy.Poll
+         :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll
+      .. class:: tweepy.Poll
 
-.. class:: tweepy.ReferencedTweet
+         :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet
+      .. class:: tweepy.ReferencedTweet
 
-.. class:: tweepy.Tweet
+         :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet
+      .. class:: tweepy.Tweet
 
-.. class:: tweepy.User
+         :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet
 
-   :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user
+      .. class:: tweepy.User
+
+         :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user
index 936f9747a8399979b921c2f04c0ffdef81e58c4d..a96f36a0d0123a0ededdeeaf1458edb3b3158fbe 100644 (file)
@@ -6,49 +6,52 @@
 Pagination
 **********
 
-API v1.1
-========
+.. tabs::
 
-.. autoclass:: Cursor
-    :members:
+    .. group-tab:: API v1.1
+
+        .. autoclass:: Cursor
+            :members:
+
+    .. group-tab:: API v2
+
+        .. autoclass:: Paginator
+            :members:
 
 Example
 -------
 
-::
+.. tabs::
 
-    import tweepy
+    .. group-tab:: API v1.1
 
-    auth = tweepy.AppAuthHandler("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)
+            import tweepy
 
-    for page in tweepy.Cursor(api.get_followers, screen_name="TwitterDev",
-                              count=200).pages(5):
-        print(len(page))
+            auth = tweepy.AppAuthHandler("Consumer Key here", "Consumer Secret here")
+            api = tweepy.API(auth)
 
-API v2
-======
+            for status in tweepy.Cursor(api.search_tweets, "Tweepy",
+                                        count=100).items(250):
+                print(status.id)
 
-.. autoclass:: Paginator
-    :members:
+            for page in tweepy.Cursor(api.get_followers, screen_name="TwitterDev",
+                                      count=200).pages(5):
+                print(len(page))
 
-Example
--------
+    .. group-tab:: API v2
 
-::
+        ::
 
-    import tweepy
+            import tweepy
 
-    client = tweepy.Client("Bearer Token here")
+            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 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)
+            for tweet in tweepy.Paginator(client.search_recent_tweets, "Tweepy",
+                                          max_results=100).flatten(limit=250):
+                print(tweet.id)
index c1935e0ac364bad13ede6dcd27738ad00e05845c..23a89d47ab44391300d0e2e27f9bc1b31400f493 100644 (file)
@@ -1,4 +1,5 @@
 myst-parser==0.15.2
 sphinx==4.2.0
 sphinx-hoverxref==0.7b1
+sphinx-tabs==3.2.0
 sphinx_rtd_theme==1.0.0