From: Harmon Date: Thu, 24 Feb 2022 19:33:50 +0000 (-0600) Subject: Add subscriber_count field for Space X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1ffc8cda6d2b9670b86610859f21ac05d726eaf9;p=tweepy.git Add subscriber_count field for Space --- diff --git a/docs/models.rst b/docs/models.rst index 71cf7f7..a40269b 100644 --- a/docs/models.rst +++ b/docs/models.rst @@ -88,6 +88,9 @@ Models Reference .. versionchanged:: 4.4 Added ``ended_at`` and ``topic_ids`` fields + .. versionchanged:: 4.6 + Added ``subscriber_count`` field + :reference: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/space .. class:: tweepy.Tweet diff --git a/tweepy/space.py b/tweepy/space.py index 2762d6c..73c8a38 100644 --- a/tweepy/space.py +++ b/tweepy/space.py @@ -11,8 +11,8 @@ class Space(HashableID, DataMapping): __slots__ = ( "data", "id", "state", "created_at", "ended_at", "host_ids", "lang", "is_ticketed", "invited_user_ids", "participant_count", - "scheduled_start", "speaker_ids", "started_at", "title", "topic_ids", - "updated_at" + "scheduled_start", "speaker_ids", "started_at", "subscriber_count", + "title", "topic_ids", "updated_at" ) def __init__(self, data): @@ -44,6 +44,9 @@ class Space(HashableID, DataMapping): if self.started_at is not None: self.started_at = parse_datetime(self.started_at) + # https://twittercommunity.com/t/missing-documentation-for-new-space-object-subscriber-count-field-on-space-object-page/166943 + self.subscriber_count = data.get("subscriber_count") + self.title = data.get("title") self.topic_ids = data.get("topic_ids", [])