From 095f3945177cc1fe86aa8650efaa71e91778abdb Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 11 Apr 2021 14:55:10 -0500 Subject: [PATCH] Update and improve documentation for API.geo_id Automatically use docstring for documentation Improve method and documentation order Add API documentation headers to match API reference index Update parameter name in documentation Add return type to documentation Improve formatting --- docs/api.rst | 15 ++++++++------- tweepy/api.py | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 082887f..00850aa 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -240,6 +240,14 @@ Get trends near a location .. automethod:: API.trends_place +Geo +--- + +Get information about a place +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automethod:: API.geo_id + Account Methods --------------- @@ -377,13 +385,6 @@ Geo Methods This is only a guideline, which may not be adhered to. -.. method:: API.geo_id(id) - - Given *id* of a place, provide more details about that place. - - :param id: Valid Twitter ID of a location. - - Utility methods --------------- diff --git a/tweepy/api.py b/tweepy/api.py index ce446ce..54c9dbf 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2660,6 +2660,22 @@ class API: ), id=id, **kwargs ) + # Get information about a place + + @payload('place') + def geo_id(self, place_id, **kwargs): + """geo_id(place_id) + + Given ``place_id``, provide more details about that place. + + :param place_id: Valid Twitter ID of a location. + + :rtype: :class:`Place` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/geo/place-information/api-reference/get-geo-id-place_id + """ + return self.request('GET', f'geo/id/{place_id}', **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 @@ -2702,12 +2718,6 @@ class API: ), lat=lat, long=long, **kwargs ) - @payload('place') - def geo_id(self, place_id, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/geo/place-information/api-reference/get-geo-id-place_id - """ - return self.request('GET', f'geo/id/{place_id}', **kwargs) - @payload('place', list=True) def geo_search(self, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/geo/places-near-location/api-reference/get-geo-search -- 2.25.1