From: Harmon Date: Sun, 27 Feb 2022 20:01:14 +0000 (-0600) Subject: Add documentation for Poll X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=61ed5d7be1bb023b43ed5522da345223a04f1ea4;p=tweepy.git Add documentation for Poll --- diff --git a/docs/v2_models.rst b/docs/v2_models.rst index f8e1b9c..8d824ec 100644 --- a/docs/v2_models.rst +++ b/docs/v2_models.rst @@ -23,9 +23,10 @@ Models .. autoclass:: Place() -.. class:: tweepy.Poll +:class:`Poll` +============= - :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll +.. autoclass:: Poll() .. class:: tweepy.ReferencedTweet diff --git a/tweepy/poll.py b/tweepy/poll.py index 659a3e3..45f2749 100644 --- a/tweepy/poll.py +++ b/tweepy/poll.py @@ -7,6 +7,36 @@ from tweepy.utils import parse_datetime class Poll(HashableID, DataMapping): + """A poll included in a Tweet is not a primary object on any endpoint, but + can be found and expanded in the Tweet object. + + The object is available for expansion with + ``?expansions=attachments.poll_ids`` to get the condensed object with only + default fields. Use the expansion with the field parameter: ``poll.fields`` + when requesting additional fields to complete the object. + + .. versionadded:: 4.0 + + Attributes + ---------- + data : dict + The JSON data representing the poll. + id : str + Unique identifier of the expanded poll. + options : list + Contains objects describing each choice in the referenced poll. + duration_minutes : int | None + Specifies the total duration of this poll. + end_datetime : datetime.datetime | None + Specifies the end date and time for this poll. + voting_status : str | None + Indicates if this poll is still active and can receive votes, or if the + voting is now closed. + + References + ---------- + https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll + """ __slots__ = ( "data", "id", "options", "duration_minutes", "end_datetime",