Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing "variants" to Media Object #1910

Merged
merged 2 commits into from
Oct 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions tweepy/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class Media(DataMapping):
A description of an image to enable and support accessibility. Can be
up to 1000 characters long. Alt text can only be added to images at the
moment.
variants: list[dict] | None
Each media object may have multiple display or playback variants,
with different resolutions or formats

References
----------
Expand All @@ -70,6 +73,7 @@ class Media(DataMapping):
"data", "media_key", "url", "type", "duration_ms", "height",
"non_public_metrics", "organic_metrics", "preview_image_url",
"promoted_metrics", "public_metrics", "width", "alt_text",
"variants"
)

def __init__(self, data):
Expand All @@ -87,6 +91,7 @@ def __init__(self, data):
self.public_metrics = data.get("public_metrics")
self.width = data.get("width")
self.alt_text = data.get("alt_text")
self.variants = data.get("variants")

def __eq__(self, other):
if isinstance(other, self.__class__):
Expand Down