Skip to content

upload_video infinite loop with check progress #549

@jvazquez

Description

@jvazquez

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.

pizza.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions