You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to upload a .webp image the library throws an error, for example...
Code: account.tweet(text, media=[{"media": "image.webp", "alt": "some nice words about img"}])
Will produce this error:
Traceback (most recent call last):
File "main.py", line 150, in <module>
send_tweet = alerts.twt(tweet["text"], tweet["media"])
File "alerts.py", line 48, in twt
tweet_sent = account.tweet(alert, media=media)
File "venv\lib\site-packages\twitter\account.py", line 160, in tweet
media_id = self._upload_media(m['media'])
File "venv\lib\site-packages\twitter\account.py", line 512, in _upload_media
media_category = f'{upload_type}_gif' if 'gif' in media_type else f'{upload_type}_{media_type.split("/")[0]}'
TypeError: argument of type 'NoneType' is not iterable
But if you go to venv\lib\site-packages\twitter\account.py
Line 510 and add:
# Add .webp MIME type
mimetypes.add_type('image/webp', '.webp')
Now you can upload .webp media
Issues aside, thank you for maintaining this Trevor <3
The text was updated successfully, but these errors were encountered:
.webp
is supported by the API via Twitter Media Best PracticesIf you try to upload a .webp image the library throws an error, for example...
Code:
account.tweet(text, media=[{"media": "image.webp", "alt": "some nice words about img"}])
Will produce this error:
But if you go to
venv\lib\site-packages\twitter\account.py
Line
510
and add:Now you can upload
.webp
mediaIssues aside, thank you for maintaining this Trevor <3
The text was updated successfully, but these errors were encountered: