upload_video infinite loop with check progress #549

Open
opened 2023-01-27 07:29:10 -08:00 by jvazquez · 0 comments
jvazquez commented 2023-01-27 07:29:10 -08:00 (Migrated from github.com)

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 video

I 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

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 video` I 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
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#549
No description provided.