From: Harmon Date: Sun, 11 Apr 2021 19:03:01 +0000 (-0500) Subject: Update and improve documentation for API.trends_available X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f3f58cbff47285d853e51eaab9a389c02f25d4a7;p=tweepy.git Update and improve documentation for API.trends_available Automatically use docstring for documentation Improve method and documentation order Add API documentation headers to match API reference index --- diff --git a/docs/api.rst b/docs/api.rst index d096222..4da3a57 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -225,6 +225,14 @@ Upload media .. automethod:: API.chunked_upload_init +Trends +------ + +Get locations with trending topics +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automethod:: API.trends_available + Account Methods --------------- @@ -341,16 +349,6 @@ Search Methods Trends Methods -------------- -.. method:: API.trends_available() - - Returns the locations that Twitter has trending topic information for. - The response is an array of "locations" that encode the location's WOEID - (a Yahoo! Where On Earth ID) and some other human-readable information such - as a canonical name and country the location belongs in. - - :rtype: :class:`JSON` object - - .. method:: API.trends_place(id, [exclude]) Returns the top 50 trending topics for a specific WOEID, diff --git a/tweepy/api.py b/tweepy/api.py index 1bb075f..e0a8dad 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2574,6 +2574,24 @@ class API: upload_api=True, **kwargs ) + # Get locations with trending topics + + @payload('json') + def trends_available(self, **kwargs): + """trends_available() + + Returns the locations that Twitter has trending topic information for. + The response is an array of "locations" that encode the location's + WOEID (a Yahoo! Where On Earth ID) and some other human-readable + information such as a canonical name and country the location belongs + in. + + :rtype: :class:`JSON` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/trends/locations-with-trending-topics/api-reference/get-trends-available + """ + return self.request('GET', 'trends/available', **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 @@ -2584,12 +2602,6 @@ class API: ), use_cache=False, **kwargs ) - @payload('json') - def trends_available(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/trends/locations-with-trending-topics/api-reference/get-trends-available - """ - return self.request('GET', 'trends/available', **kwargs) - @payload('json') def trends_place(self, id, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/trends/trends-for-location/api-reference/get-trends-place