Add missing variant to Media Object
authorDevesh Pal <newdev0@outlook.com>
Thu, 9 Jun 2022 10:31:19 +0000 (16:01 +0530)
committerGitHub <noreply@github.com>
Thu, 9 Jun 2022 10:31:19 +0000 (16:01 +0530)
tweepy/media.py

index 7351dde5429e77c9fdc2af77c97fa9357a194207..1729a2c61b34900b39764d66ea7d8c952ff73b14 100644 (file)
@@ -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
     ----------
@@ -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):
@@ -87,6 +91,7 @@ class Media(DataMapping):
         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__):