mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-12-02 16:31:12 +00:00
More debug messages
This commit is contained in:
parent
1d40071b27
commit
a9109884a4
4
twoot.py
4
twoot.py
|
@ -489,7 +489,7 @@ def main(argv):
|
||||||
# Upload video if there is one
|
# Upload video if there is one
|
||||||
if tweet['video'] is not None:
|
if tweet['video'] is not None:
|
||||||
try:
|
try:
|
||||||
logging.debug("Uploading video")
|
logging.debug("Uploading video to Mastodon")
|
||||||
media_posted = mastodon.media_post(tweet['video'])
|
media_posted = mastodon.media_post(tweet['video'])
|
||||||
media_ids.append(media_posted['id'])
|
media_ids.append(media_posted['id'])
|
||||||
except (MastodonAPIError, MastodonIllegalArgumentError, TypeError): # Media cannot be uploaded (invalid format, dead link, etc.)
|
except (MastodonAPIError, MastodonIllegalArgumentError, TypeError): # Media cannot be uploaded (invalid format, dead link, etc.)
|
||||||
|
@ -502,6 +502,7 @@ def main(argv):
|
||||||
media = False
|
media = False
|
||||||
# Download picture
|
# Download picture
|
||||||
try:
|
try:
|
||||||
|
logging.debug('downloading picture')
|
||||||
media = requests.get(photo)
|
media = requests.get(photo)
|
||||||
except: # Picture cannot be downloaded for any reason
|
except: # Picture cannot be downloaded for any reason
|
||||||
pass
|
pass
|
||||||
|
@ -509,6 +510,7 @@ def main(argv):
|
||||||
# Upload picture to Mastodon instance
|
# Upload picture to Mastodon instance
|
||||||
if media:
|
if media:
|
||||||
try:
|
try:
|
||||||
|
logging.debug('uploading picture to Mastodon')
|
||||||
media_posted = mastodon.media_post(media.content, mime_type=media.headers['content-type'])
|
media_posted = mastodon.media_post(media.content, mime_type=media.headers['content-type'])
|
||||||
media_ids.append(media_posted['id'])
|
media_ids.append(media_posted['id'])
|
||||||
except (MastodonAPIError, MastodonIllegalArgumentError, TypeError): # Media cannot be uploaded (invalid format, dead link, etc.)
|
except (MastodonAPIError, MastodonIllegalArgumentError, TypeError): # Media cannot be uploaded (invalid format, dead link, etc.)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user