From: Harmon Date: Sun, 11 Apr 2021 19:06:31 +0000 (-0500) Subject: Update and improve documentation for API.trends_closest X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=535940568d6260beaabcde2fc5e5789227dcf9e1;p=tweepy.git Update and improve documentation for API.trends_closest Automatically use docstring for documentation Improve method and documentation order --- diff --git a/docs/api.rst b/docs/api.rst index 4da3a57..2db695a 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -233,6 +233,8 @@ Get locations with trending topics .. automethod:: API.trends_available +.. automethod:: API.trends_closest + Account Methods --------------- @@ -373,28 +375,6 @@ Trends Methods :rtype: :class:`JSON` object -.. method:: API.trends_closest(lat, long) - - Returns the locations that Twitter has trending topic information for, - closest to a specified location. - - The response is an array of “locations” that encode the location’s WOEID and - some other human-readable information such as a canonical name and country - the location belongs in. - - A WOEID is a Yahoo! Where On Earth ID. - - :param lat: If provided with a long parameter the available trend locations - will be sorted by distance, nearest to furthest, to the - co-ordinate pair. The valid ranges for longitude is -180.0 to - +180.0 (West is negative, East is positive) inclusive. - :param long: If provided with a lat parameter the available trend locations - will be sorted by distance, nearest to furthest, to the - co-ordinate pair. The valid ranges for longitude is -180.0 to - +180.0 (West is negative, East is positive) inclusive. - :rtype: :class:`JSON` object - - Geo Methods ----------- diff --git a/tweepy/api.py b/tweepy/api.py index e0a8dad..12ee6d8 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2592,6 +2592,38 @@ class API: """ return self.request('GET', 'trends/available', **kwargs) + @payload('json') + def trends_closest(self, lat, long, **kwargs): + """trends_closest(lat, long) + + Returns the locations that Twitter has trending topic information for, + closest to a specified location. + + The response is an array of “locations” that encode the location’s + WOEID and some other human-readable information such as a canonical + name and country the location belongs in. + + A WOEID is a Yahoo! Where On Earth ID. + + :param lat: If provided with a long parameter the available trend + locations will be sorted by distance, nearest to furthest, to the + co-ordinate pair. The valid ranges for longitude is -180.0 to + +180.0 (West is negative, East is positive) inclusive. + :param long: If provided with a lat parameter the available trend + locations will be sorted by distance, nearest to furthest, to the + co-ordinate pair. The valid ranges for longitude is -180.0 to + +180.0 (West is negative, East is positive) inclusive. + + :rtype: :class:`JSON` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/trends/locations-with-trending-topics/api-reference/get-trends-closest + """ + return self.request( + 'GET', 'trends/closest', endpoint_parameters=( + 'lat', 'long' + ), lat=lat, long=long, **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 @@ -2612,16 +2644,6 @@ class API: ), id=id, **kwargs ) - @payload('json') - def trends_closest(self, lat, long, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/trends/locations-with-trending-topics/api-reference/get-trends-closest - """ - return self.request( - 'GET', 'trends/closest', endpoint_parameters=( - 'lat', 'long' - ), lat=lat, long=long, **kwargs - ) - @pagination(mode='next') @payload('status', list=True) def search_30_day(self, label, query, **kwargs):