From e3fa2238819b9678cabfc2b8068cd35a11747b0a Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 27 Feb 2022 13:55:23 -0600 Subject: [PATCH] Add documentation for Place --- docs/v2_models.rst | 5 +++-- tweepy/place.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/docs/v2_models.rst b/docs/v2_models.rst index fc702f7..f8e1b9c 100644 --- a/docs/v2_models.rst +++ b/docs/v2_models.rst @@ -18,9 +18,10 @@ Models .. autoclass:: Media() -.. class:: tweepy.Place +:class:`Place` +============== - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place +.. autoclass:: Place() .. class:: tweepy.Poll diff --git a/tweepy/place.py b/tweepy/place.py index 6b9d08f..4306123 100644 --- a/tweepy/place.py +++ b/tweepy/place.py @@ -6,6 +6,44 @@ from tweepy.mixins import DataMapping, HashableID class Place(HashableID, DataMapping): + """The place tagged in a Tweet is not a primary object on any endpoint, but + can be found and expanded in the Tweet resource. + + The object is available for expansion with ``?expansions=geo.place_id`` to + get the condensed object with only default fields. Use the expansion with + the field parameter: ``place.fields`` when requesting additional fields to + complete the object. + + .. versionadded:: 4.0 + + Attributes + ---------- + data : dict + The JSON data representing the place. + full_name : str + A longer-form detailed place name. + id : str + The unique identifier of the expanded place, if this is a point of + interest tagged in the Tweet. + contained_within : list | None + Returns the identifiers of known places that contain the referenced + place. + country : str | None + The full-length name of the country this place belongs to. + country_code : str | None + The ISO Alpha-2 country code this place belongs to. + geo : dict | None + Contains place details in GeoJSON format. + name : str | None + The short name of this place. + place_type : str | None + Specified the particular type of information represented by this place + information, such as a city name, or a point of interest. + + References + ---------- + https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place + """ __slots__ = ( "data", "full_name", "id", "contained_within", "country", -- 2.25.1