- Notifications
You must be signed in to change notification settings - Fork50
Sample Python code for uploading video up to 140 seconds and/or up to 512Mb.
License
xdevplatform/large-video-upload-python
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This Python sample demonstrates the following process of uploading large media (video / GIF / image) files asynchronously with the Twitter API, via the "chunked upload" method.
- INIT media upload.
- APPEND chunked data.
- FINALIZE media uploaded.
- CheckSTATUS of media processing.
- Tweet with attached media.
Large video files are longer than 30 seconds / up to 140 seconds, and/or a file size larger than 15 megabytes up to 512 megabytes.
Learn more about the Twitter Media APIs. Pay attention to the other requirements such as encoding, frame size and video formats supported, as these may be reasons for uploads failing at the processing stage.
Install requirements:
$ pipenv shell$ pipenv install
Fill in yourconsumer keys and access tokens in
async-upload.py
:CONSUMER_KEY = 'your-consumer-key'CONSUMER_SECRET = 'your-consumer-secret'ACCESS_TOKEN = 'your-access-token'ACCESS_TOKEN_SECRET = 'your-access-secret'
Edit path to your media file in
async-upload.py
:
VIDEO_FILENAME = 'path/to/video/file'
Run script:
$ python async-upload.py
Questions? Check ourdeveloper discussion forums.
About
Sample Python code for uploading video up to 140 seconds and/or up to 512Mb.
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.