mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-02-22 00:02:08 +00:00
Try to not specify mime_type to fix crash when mime_type is NoneType
This commit is contained in:
parent
1d4270cb00
commit
3387e363d5
6
twoot.py
6
twoot.py
|
@ -314,15 +314,11 @@ def main(argv):
|
|||
# Download picture
|
||||
media = requests.get(photo)
|
||||
|
||||
# Fix to avoid media_post failing because mime_type is NoneType
|
||||
# "Can only concatenate str to str"
|
||||
mime_type = media.headers['content-type']
|
||||
if type(mime_type) is None:
|
||||
mime_type = ""
|
||||
|
||||
# Upload picture to Mastodon instance
|
||||
try:
|
||||
media_posted = mastodon.media_post(media.content, mime_type)
|
||||
media_posted = mastodon.media_post(media.content)
|
||||
media_ids.append(media_posted['id'])
|
||||
except MastodonAPIError: # Media cannot be uploaded (invalid format, dead link, etc.)
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue
Block a user