From 23d063cff0c15cbfd4ddb97863d4cba16cacac02 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 11 Apr 2021 15:25:29 -0500 Subject: [PATCH] Update and improve documentation for API.configuration Automatically use docstring for documentation Improve method and documentation order Add API documentation headers to match API reference index Add return type to documentation --- docs/api.rst | 19 ++++++++----------- tweepy/api.py | 25 +++++++++++++++++++------ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 4c72ccd..7aa78ad 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -255,6 +255,14 @@ Get places near a location .. automethod:: API.geo_search +Developer utilities +------------------- + +Get Twitter configuration details +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automethod:: API.configuration + Account Methods --------------- @@ -368,17 +376,6 @@ Search Methods provided by the API, and should not be modified. -Utility methods ---------------- - -.. method:: API.configuration() - - Returns the current configuration used by Twitter including twitter.com - slugs which are not usernames, maximum photo resolutions, and t.co - shortened URL length. It is recommended applications request this endpoint - when they are loaded, but no more than once a day. - - :mod:`tweepy.error` --- Exceptions ================================== diff --git a/tweepy/api.py b/tweepy/api.py index e8b8285..607cffd 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2769,6 +2769,25 @@ class API: ), **kwargs ) + # Get Twitter configuration details + + @payload('json') + def configuration(self, **kwargs): + """configuration() + + Returns the current configuration used by Twitter including twitter.com + slugs which are not usernames, maximum photo resolutions, and t.co + shortened URL length. + + It is recommended applications request this endpoint when they are + loaded, but no more than once a day. + + :rtype: :class:`JSON` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/configuration/api-reference/get-help-configuration + """ + return self.request('GET', 'help/configuration', **kwargs) + @payload('json') def rate_limit_status(self, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status @@ -2806,9 +2825,3 @@ class API: """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/supported-languages/api-reference/get-help-languages """ return self.request('GET', 'help/languages', **kwargs) - - @payload('json') - def configuration(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/configuration/api-reference/get-help-configuration - """ - return self.request('GET', 'help/configuration', **kwargs) -- 2.25.1