1 Original repo: https://github.com/twitterdev/large-video-upload-python
2 Changes here are meant to be rebased.
6 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.
8 1. **INIT** media upload.
9 2. **APPEND** chunked data.
10 3. **FINALIZE** media uploaded.
11 4. Check **STATUS** of media processing.
12 5. Tweet with attached media.
14 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.
16 [Learn more](https://developer.twitter.com/en/docs/media/upload-media/overview) 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.
20 1. Install requirements:
27 2. Fill in your [consumer keys and access tokens](https://developer.twitter.com/en/apps) in `async-upload.py`:
30 CONSUMER_KEY = 'your-consumer-key'
31 CONSUMER_SECRET = 'your-consumer-secret'
32 ACCESS_TOKEN = 'your-access-token'
33 ACCESS_TOKEN_SECRET = 'your-access-secret'
36 3. Edit path to your media file in `async-upload.py`:
39 VIDEO_FILENAME = 'path/to/video/file'
45 $ python async-upload.py
48 Questions? Check our [developer discussion forums](https://https://twittercommunity.com/c/media-apis).