From 2aa05468e023b9789b11d384822f9bc364d7b745 Mon Sep 17 00:00:00 2001 From: ikaroskun Date: Wed, 13 Mar 2024 15:04:04 +0800 Subject: [PATCH 1/2] feat(model): :sparkles: add new fields from twitter tweet --- pytwitter/models/media.py | 3 ++- pytwitter/models/tweet.py | 15 +++++++++++++-- pytwitter/models/user.py | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/pytwitter/models/media.py b/pytwitter/models/media.py index 7aa10a3..83d3b56 100644 --- a/pytwitter/models/media.py +++ b/pytwitter/models/media.py @@ -25,7 +25,8 @@ class MediaOrganicMetrics(MediaNonPublicMetrics): @dataclass -class MediaPromotedMetrics(MediaOrganicMetrics): ... +class MediaPromotedMetrics(MediaOrganicMetrics): + ... @dataclass diff --git a/pytwitter/models/tweet.py b/pytwitter/models/tweet.py index cf1b740..a63677d 100644 --- a/pytwitter/models/tweet.py +++ b/pytwitter/models/tweet.py @@ -69,7 +69,8 @@ class TweetEntitiesHashtag(BaseModel): @dataclass -class TweetEntitiesCashtag(TweetEntitiesHashtag): ... +class TweetEntitiesCashtag(TweetEntitiesHashtag): + ... @dataclass @@ -130,7 +131,8 @@ class TweetOrganicMetrics(TweetNonPublicMetrics): @dataclass -class TweetPromotedMetrics(TweetOrganicMetrics): ... +class TweetPromotedMetrics(TweetOrganicMetrics): + ... @dataclass @@ -159,6 +161,12 @@ class TweetReferencedTweet(BaseModel): id: Optional[str] = field(default=None, repr=False, compare=False) +@dataclass +class TweetNoteTweet(BaseModel): + text: Optional[str] = field(default=None, repr=False, compare=False) + entities: Optional[TweetEntities] = field(default=None, repr=False, compare=False) + + @dataclass class Tweet(BaseModel): """ @@ -203,6 +211,9 @@ class Tweet(BaseModel): reply_settings: Optional[str] = field(default=None, repr=False, compare=False) source: Optional[str] = field(default=None, repr=False, compare=False) withheld: Optional[TweetWithheld] = field(default=None, repr=False, compare=False) + note_tweet: Optional[TweetNoteTweet] = field( + default=None, repr=False, compare=False + ) # Note: this field only for stream tweet matching_rules: Optional[List[StreamRule]] = field( diff --git a/pytwitter/models/user.py b/pytwitter/models/user.py index ebc452d..7fb6b5d 100644 --- a/pytwitter/models/user.py +++ b/pytwitter/models/user.py @@ -27,7 +27,8 @@ class UserEntitiesHashtag(BaseModel): @dataclass -class UserEntitiesMention(UserEntitiesHashtag): ... +class UserEntitiesMention(UserEntitiesHashtag): + ... @dataclass From 6618f90075d972384c04f8e1b0ac47924324f5f9 Mon Sep 17 00:00:00 2001 From: ikaroskun Date: Wed, 13 Mar 2024 15:09:40 +0800 Subject: [PATCH 2/2] style(model): :art: format code with new black --- pytwitter/models/media.py | 2 +- pytwitter/models/tweet.py | 4 ++-- pytwitter/models/user.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pytwitter/models/media.py b/pytwitter/models/media.py index 83d3b56..da60fc5 100644 --- a/pytwitter/models/media.py +++ b/pytwitter/models/media.py @@ -26,7 +26,7 @@ class MediaOrganicMetrics(MediaNonPublicMetrics): @dataclass class MediaPromotedMetrics(MediaOrganicMetrics): - ... + pass @dataclass diff --git a/pytwitter/models/tweet.py b/pytwitter/models/tweet.py index a63677d..b0f1d17 100644 --- a/pytwitter/models/tweet.py +++ b/pytwitter/models/tweet.py @@ -70,7 +70,7 @@ class TweetEntitiesHashtag(BaseModel): @dataclass class TweetEntitiesCashtag(TweetEntitiesHashtag): - ... + pass @dataclass @@ -132,7 +132,7 @@ class TweetOrganicMetrics(TweetNonPublicMetrics): @dataclass class TweetPromotedMetrics(TweetOrganicMetrics): - ... + pass @dataclass diff --git a/pytwitter/models/user.py b/pytwitter/models/user.py index 7fb6b5d..5dbd0e8 100644 --- a/pytwitter/models/user.py +++ b/pytwitter/models/user.py @@ -28,7 +28,7 @@ class UserEntitiesHashtag(BaseModel): @dataclass class UserEntitiesMention(UserEntitiesHashtag): - ... + pass @dataclass