From 743f87d6036665c3e02a3e286d9bb7ebbccd7630 Mon Sep 17 00:00:00 2001 From: Harmon Date: Tue, 19 Apr 2022 15:14:44 -0500 Subject: [PATCH] Update documentation for Media.url --- tweepy/media.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tweepy/media.py b/tweepy/media.py index ea7fae3..7351dde 100644 --- a/tweepy/media.py +++ b/tweepy/media.py @@ -28,6 +28,8 @@ class Media(DataMapping): Unique identifier of the expanded media content. type : str Type of content (animated_gif, photo, video). + url : str | None + A direct URL to the media file on Twitter. duration_ms : int | None Available when type is video. Duration in milliseconds of the video. height : int | None @@ -57,8 +59,7 @@ class Media(DataMapping): alt_text : str | None 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. - url : str | None + moment. References ---------- @@ -66,9 +67,9 @@ class Media(DataMapping): """ __slots__ = ( - "data", "media_key", "type", "duration_ms", "height", + "data", "media_key", "url", "type", "duration_ms", "height", "non_public_metrics", "organic_metrics", "preview_image_url", - "promoted_metrics", "public_metrics", "width", "alt_text", "url" + "promoted_metrics", "public_metrics", "width", "alt_text", ) def __init__(self, data): @@ -76,6 +77,7 @@ class Media(DataMapping): self.media_key = data["media_key"] self.type = data["type"] + self.url = data.get("url") self.duration_ms = data.get("duration_ms") self.height = data.get("height") self.non_public_metrics = data.get("non_public_metrics") @@ -86,9 +88,6 @@ class Media(DataMapping): self.width = data.get("width") self.alt_text = data.get("alt_text") - # https://twittercommunity.com/t/documentation-for-media-object-missing-url-field/163062 - self.url = data.get("url") - def __eq__(self, other): if isinstance(other, self.__class__): return self.media_key == other.media_key -- 2.25.1