Handle incorrect processing state for errored chunked uploads
authorHarmon <Harmon758@gmail.com>
Sat, 11 Feb 2023 00:10:20 +0000 (18:10 -0600)
committerHarmon <Harmon758@gmail.com>
Sat, 11 Feb 2023 00:10:20 +0000 (18:10 -0600)
tweepy/api.py

index 5279c7460766bb1ef5a4440101068e0bdd90a3cb..3d755c8e68b22d9d4c1bcc4c122aab71efc3e7e7 100644 (file)
@@ -3684,7 +3684,11 @@ class API:
         media =  self.chunked_upload_finalize(media_id, **kwargs)
 
         if wait_for_async_finalize and hasattr(media, 'processing_info'):
-            while media.processing_info['state'] in ('pending', 'in_progress'):
+            while (
+                media.processing_info['state'] in (
+                    'pending', 'in_progress'
+                ) and 'error' not in media.processing_info
+            ):
                 time.sleep(media.processing_info['check_after_secs'])
                 media = self.get_media_upload_status(media.media_id, **kwargs)