.. automethod:: API.geo_id
+Get places near a location
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. automethod:: API.reverse_geocode
+
Account Methods
---------------
provided by the API, and should not be modified.
-Geo Methods
------------
-
-.. method:: API.reverse_geocode([lat], [long], [accuracy], [granularity], \
- [max_results])
-
- Given a latitude and longitude, looks for places (cities and neighbourhoods)
- whose IDs can be specified in a call to :func:`update_status` to appear as
- the name of the location. This call provides a detailed response about the
- location in question; the :func:`nearby_places` function should be preferred
- for getting a list of places nearby without great detail.
-
- :param lat: The location's latitude.
- :param long: The location's longitude.
- :param accuracy: Specify the "region" in which to search, such as a number
- (then this is a radius in meters, but it can also take a
- string that is suffixed with ft to specify feet).
- If this is not passed in, then it is assumed to be 0m
- :param granularity: Assumed to be ``neighborhood`` by default; can also be
- ``city``.
- :param max_results: A hint as to the maximum number of results to return.
- This is only a guideline, which may not be adhered to.
-
-
Utility methods
---------------
"""
return self.request('GET', f'geo/id/{place_id}', **kwargs)
+ # Get places near a location
+
+ @payload('place', list=True)
+ def reverse_geocode(self, lat, long, **kwargs):
+ """reverse_geocode(lat, long, *, accuracy, granularity, max_results)
+
+ Given a latitude and a longitude, searches for up to 20 places that can
+ be used as a ``place_id`` when updating a status.
+
+ This request is an informative call and will deliver generalized
+ results about geography.
+
+ :param lat: The location's latitude.
+ :param long: The location's longitude.
+ :param accuracy: Specify the "region" in which to search, such as a
+ number (then this is a radius in meters, but it can also take a
+ string that is suffixed with ft to specify feet). If this is not
+ passed in, then it is assumed to be 0m
+ :param granularity: Assumed to be ``neighborhood`` by default; can also
+ be ``city``.
+ :param max_results: A hint as to the maximum number of results to
+ return. This is only a guideline, which may not be adhered to.
+
+ :rtype: list of :class:`Place` objects
+
+ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/geo/places-near-location/api-reference/get-geo-reverse_geocode
+ """
+ return self.request(
+ 'GET', 'geo/reverse_geocode', endpoint_parameters=(
+ 'lat', 'long', 'accuracy', 'granularity', 'max_results'
+ ), 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
), query=query, **kwargs
)
- @payload('place', list=True)
- def reverse_geocode(self, lat, long, **kwargs):
- """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/geo/places-near-location/api-reference/get-geo-reverse_geocode
- """
- return self.request(
- 'GET', 'geo/reverse_geocode', endpoint_parameters=(
- 'lat', 'long', 'accuracy', 'granularity', 'max_results'
- ), lat=lat, long=long, **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