From 9bb8446837562424093d4c65b6c389d2f1228c62 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 11 Apr 2021 15:29:02 -0500 Subject: [PATCH] Document API.supported_languages Automatically use docstring for documentation Improve method order Add API documentation header to match API reference index --- docs/api.rst | 5 +++++ tweepy/api.py | 25 +++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 7aa78ad..d64e87a 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -263,6 +263,11 @@ Get Twitter configuration details .. automethod:: API.configuration +Get Twitter supported languages +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automethod:: API.supported_languages + Account Methods --------------- diff --git a/tweepy/api.py b/tweepy/api.py index 607cffd..9f3146a 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2788,6 +2788,25 @@ class API: """ return self.request('GET', 'help/configuration', **kwargs) + # Get Twitter supported languages + + @payload('json') + def supported_languages(self, **kwargs): + """supported_languages() + + Returns the list of languages supported by Twitter along with the + language code supported by Twitter. + + The language code may be formatted as ISO 639-1 alpha-2 (``en``), ISO + 639-3 alpha-3 (``msa``), or ISO 639-1 alpha-2 combined with an ISO + 3166-1 alpha-2 localization (``zh-tw``). + + :rtype: :class:`JSON` object + + :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 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 @@ -2819,9 +2838,3 @@ class API: 'query', 'tag', 'fromDate', 'toDate', 'maxResults', 'next' ), query=query, **kwargs ) - - @payload('json') - def supported_languages(self, **kwargs): - """ :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) -- 2.25.1