first set of updates (close #5, #7) (#9)
[video-tweet.git] / README.md
1 # Large Media Upload
2
3 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.
4
5 1. **INIT** media upload.
6 2. **APPEND** chunked data.
7 3. **FINALIZE** media uploaded.
8 4. Check **STATUS** of media processing.
9 5. Tweet with attached media.
10
11 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.
12
13 [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.
14
15 ## Running the sample
16
17 1. Install requirements:
18
19 ```
20 $ pipenv shell
21 $ pipenv install
22 ```
23
24 2. Fill in your [consumer keys and access tokens](https://developer.twitter.com/en/apps) in `async-upload.py`:
25
26 ```
27 CONSUMER_KEY = 'your-consumer-key'
28 CONSUMER_SECRET = 'your-consumer-secret'
29 ACCESS_TOKEN = 'your-access-token'
30 ACCESS_TOKEN_SECRET = 'your-access-secret'
31 ```
32
33 3. Edit path to your media file in `async-upload.py`:
34
35 ```
36 VIDEO_FILENAME = 'path/to/video/file'
37 ```
38
39 4. Run script:
40
41 ```
42 $ python async-upload.py
43 ```
44
45 Questions? Check our [developer discussion forums](https://https://twittercommunity.com/c/media-apis).