Add creator_id field for Space
authorHarmon <Harmon758@gmail.com>
Sat, 18 Mar 2023 11:20:32 +0000 (06:20 -0500)
committerHarmon <Harmon758@gmail.com>
Sat, 18 Mar 2023 11:20:32 +0000 (06:20 -0500)
This field has been missing documentation on https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/space

tweepy/space.py

index f40be524a4ad7cfa9c515131fd5fc21f99a0daad..128630ca15abfd2e6c2025293c9ac90b5fb3c8fb 100644 (file)
@@ -31,6 +31,9 @@ class Space(HashableID, DataMapping):
     .. versionchanged:: 4.6
         Added ``subscriber_count`` field
 
+    .. versionchanged:: 4.14
+        Added ``creator_id`` field
+
     Attributes
     ----------
     data : dict
@@ -76,6 +79,7 @@ class Space(HashableID, DataMapping):
     updated_at : datetime.datetime | None
         Specifies the date and time of the last update to any of the Space's
         metadata, such as its title or scheduled time.
+    creator_id : int | None
 
     References
     ----------
@@ -88,7 +92,7 @@ class Space(HashableID, DataMapping):
         "data", "id", "state", "created_at", "ended_at", "host_ids", "lang",
         "is_ticketed", "invited_user_ids", "participant_count",
         "subscriber_count", "scheduled_start", "speaker_ids", "started_at",
-        "title", "topic_ids", "updated_at"
+        "title", "topic_ids", "updated_at", "creator_id"
     )
 
     def __init__(self, data):
@@ -129,5 +133,9 @@ class Space(HashableID, DataMapping):
         if self.updated_at is not None:
             self.updated_at = parse_datetime(self.updated_at)
 
+        self.creator_id = data.get("creator_id")
+        if self.creator_id is not None:
+            self.creator_id = int(self.creator_id)
+
     def __repr__(self):
         return f"<Space id={self.id} state={self.state}>"