Add subscriber_count field for Space
authorHarmon <Harmon758@gmail.com>
Thu, 24 Feb 2022 19:33:50 +0000 (13:33 -0600)
committerHarmon <Harmon758@gmail.com>
Thu, 24 Feb 2022 19:33:50 +0000 (13:33 -0600)
docs/models.rst
tweepy/space.py

index 71cf7f716d15006ec8d8c6533df87a91e53bafba..a40269b0ec2fdfe1df99901943c14b5ddd7d9e70 100644 (file)
@@ -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
index 2762d6ced846bc1bdab320b81aa24974b8f8dd8d..73c8a38791e6f66f2e1b18408faafdcf9ee53b68 100644 (file)
@@ -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", [])