upload_video infinite loop with check progress #549
Labels
No labels
Bug
Enhancement
Feature Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: code/twython#549
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hey there, I noticed a particular behavior when uploading the attached video, I'm consuming v1.1 standard
When https://github.com/ryanmcgrath/twython/blob/master/twython/endpoints.py#L174 is called with check_progress = True
The file uploads correctly.
https://github.com/ryanmcgrath/twython/blob/master/twython/endpoints.py#L235 starts, because check_progress = True
https://github.com/ryanmcgrath/twython/blob/master/twython/endpoints.py#L246 is "pending"
The code ends up looping in https://github.com/ryanmcgrath/twython/blob/master/twython/endpoints.py#L251, because
response changes from
{'media_id': 1618986262236372992, 'media_id_string': '1618986262236372992', 'media_key': '7_1618986262236372992', 'size': 902118, 'expires_after_secs': 86400, 'processing_info': {'state': 'pending', 'check_after_secs': 1}}to
{'media_id': 1618986262236372992, 'media_id_string': '1618986262236372992', 'media_key': '7_1618986262236372992', 'size': 902118, 'processing_info': {'state': 'in_progress', 'progress_percent': 100, 'error': {'code': 1, 'name': 'InvalidMedia', 'message': 'file is invalid'}}}So you end up in an infinite loop.
I ran the video through ffmpeg and initially it seems to be ok according to https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/uploading-media/media-best-practices
I attempted the code without doing check progress and it fails with
Twitter API returned a 400 (Bad Request), Not valid videoI know this bug report seems way too specific, but perhaps that particular behavior should change under these circumstances ?.
I know it's terribly specific and it may not happen to anyone and perhaps this should be closed, but just in case the same thing happens to someone else.
https://user-images.githubusercontent.com/55306/215115163-b52025d8-6155-45b4-b1e2-d4e7145d80a6.mp4