vimeo / vimeo.py

Official Python library for the Vimeo API.
https://developer.vimeo.com
Apache License 2.0
209 stars 84 forks source link

Pull Upload Support #148

Closed mhoare closed 2 years ago

mhoare commented 5 years ago

Does your SDK support pull Upload?

KalobTaulien commented 2 years ago

It does not, apparently. But I wrote this quickly and it works as far as I can tell.

data = {
    "upload": {
        "approach": "pull",
        "size": "", # TODO: Get the size in bytes
        "link": "", # TODO: https://website.com/your-video.mp4
    }
}
headers = {
    "Authorization": f"bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/vnd.vimeo.*+json;version=3.4"
}

response = requests.post(
    f"https://api.vimeo.com/me/videos",
    headers=headers,
    json=data,
)

response = response.json()
video_uri = response['uri']
aaronm67 commented 2 years ago

vimeo.py is a wrapper around requests, it supports the full API.

Ex: v.post('/me/videos', data = { 'upload': { 'approach': 'pull', ... }