curl -X PUT -H 'Content-Type: video/mp4' \
-H "Content-Length: 8036821" \
-T "/Users/kenh/Downloads/amazing_race.mp4" \
"https://hootsuite-video.s3.amazonaws.com/production/3563111_6923ef29-d2bd- 4b2a-a6d2-11295411c988.mp4?AWSAccessKeyId=AKIAIHSDDN2I7V2FDJGA&Expires=1465846288&Signature=3xLFijSn02YIx6AOOjmri5Djkko%3D"
Mainly I do not understand how to user -T line. Headers and URL I know.
-T
is documented as follows:
-T, --upload-file <file>
This transfers the specified local file to the remote URL. [...] If this is used on an HTTP(S) server, the PUT command will be used.
With that in mind, the requests
invocation, based on the Streaming Uploads doc, should be approximately
import requests
with open("/Users/kenh/Downloads/amazing_race.mp4", "rb") as data:
resp = requests.put(
url="https://....",
data=data,
headers={
"Content-type": "video/mp4",
},
)
resp.raise_for_status()
Requests will divine the content-length
header for you if it can.