Add Space.ended_at and Space.topic_ids
authorHarmon <Harmon758@gmail.com>
Wed, 17 Nov 2021 14:06:27 +0000 (08:06 -0600)
committerHarmon <Harmon758@gmail.com>
Wed, 17 Nov 2021 14:06:27 +0000 (08:06 -0600)
tweepy/space.py

index 49c3cd25fc77a264c4df063d987c1591515823f7..93f2a8032b6c647a4209679ab8d914c08e077579 100644 (file)
@@ -9,9 +9,10 @@ from tweepy.utils import parse_datetime
 class Space(HashableID, DataMapping):
 
     __slots__ = (
-        "data", "id", "state", "created_at", "host_ids", "lang", "is_ticketed",
-        "invited_user_ids", "participant_count", "scheduled_start",
-        "speaker_ids", "started_at", "title", "updated_at"
+        "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"
     )
 
     def __init__(self, data):
@@ -23,6 +24,10 @@ class Space(HashableID, DataMapping):
         if self.created_at is not None:
             self.created_at = parse_datetime(self.created_at)
 
+        self.ended_at = data.get("ended_at")
+        if self.ended_at is not None:
+            self.ended_at = parse_datetime(self.ended_at)
+
         self.host_ids = data.get("host_ids", [])
         self.lang = data.get("lang")
         self.is_ticketed = data.get("is_ticketed")
@@ -41,6 +46,8 @@ class Space(HashableID, DataMapping):
 
         self.title = data.get("title")
 
+        self.topic_ids = data.get("topic_ids", [])
+
         self.updated_at = data.get("updated_at")
         if self.updated_at is not None:
             self.updated_at = parse_datetime(self.updated_at)