Skip to content

Commit

Permalink
Add subscriber_count field for Space
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Feb 24, 2022
1 parent 18f9a27 commit 1ffc8cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/models.rst
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions tweepy/space.py
Expand Up @@ -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):
Expand Down Expand Up @@ -44,6 +44,9 @@ def __init__(self, data):
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", [])
Expand Down

0 comments on commit 1ffc8cd

Please sign in to comment.