I'm porting code from python-twitter version 1.1 to 3.1 in Zulip.
In version 1.1, twitter.Status.media used to be a list of dicts. In version 3.1, twitter.models.Status.media it is a list of twitter.models.Media.
We weren't using models in our code. We used to get a dict obtained from AsDict to access all data. I think it will be easy to quickly switch to version 3.1 if we continue to do that.
In version 1.1, twitter.Status.AsDict() didn't include media by default, so we used to add that explicitly like this - res['media'] = tweet.media (res was initialized to tweet.AsDict()). In version 3.1, media is added by default in twitter.Status.AsDict(), so we no longer need that workaround.
I noticed that the format of the dict returned by AsDict() has changed slightly. Most notably, the sizes key is no longer in the media dicts. We were using that to get the largest image smaller than a particular threshold height. Now I can't find a way to do that. Can you suggest something?
The Twitter API still seems to support sizes, as can be seen here: https://dev.twitter.com/overview/api/entities-in-twitter-objects#media.
Was the sizes key intentionally removed? If yes, why?
I'm porting code from
python-twitterversion 1.1 to 3.1 in Zulip.In version 1.1,
twitter.Status.mediaused to be alistofdicts. In version 3.1,twitter.models.Status.mediait is alistoftwitter.models.Media.We weren't using models in our code. We used to get a dict obtained from
AsDictto access all data. I think it will be easy to quickly switch to version 3.1 if we continue to do that.In version 1.1,
twitter.Status.AsDict()didn't includemediaby default, so we used to add that explicitly like this -res['media'] = tweet.media(reswas initialized totweet.AsDict()). In version 3.1, media is added by default intwitter.Status.AsDict(), so we no longer need that workaround.I noticed that the format of the dict returned by
AsDict()has changed slightly. Most notably, thesizeskey is no longer in the media dicts. We were using that to get the largest image smaller than a particular threshold height. Now I can't find a way to do that. Can you suggest something?The Twitter API still seems to support sizes, as can be seen here: https://dev.twitter.com/overview/api/entities-in-twitter-objects#media.
Was the
sizeskey intentionally removed? If yes, why?