From 36248dbce1cc7eaa80871e16bca7328b880574c5 Mon Sep 17 00:00:00 2001 From: jeancf Date: Thu, 2 Feb 2023 20:56:32 +0100 Subject: [PATCH] tentative mitigation of error 422 --- twoot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/twoot.py b/twoot.py index c48eb26..584401f 100755 --- a/twoot.py +++ b/twoot.py @@ -952,6 +952,9 @@ def main(argv): logging.debug("Uploading video to Mastodon") media_posted = mastodon.media_post(tweet['video']) media_ids.append(media_posted['id']) + # Possible mitigation for + # ERROR ('Mastodon API returned error', 422, 'Unprocessable Entity', 'Cannot attach files that have not finished processing. Try again in a moment!') + time.sleep(5) except (MastodonAPIError, MastodonIllegalArgumentError, TypeError): # Media cannot be uploaded (invalid format, dead link, etc.) logging.debug("Uploading video failed")