vimeovimeo-apivimeo-playerpyvimeo

Redirect_url ignored while Uploading to Vimeo API via Python Requests


I'm trying to upload a video to my Vimeo account from within a web-app, and the upload part is working, but I can't find a way to include the redirect_url option. In Postman it works, but in python it's just ignored. Here's the snippet:

    def get(self, request):
       url = "https://api.vimeo.com/me/videos"

       payload = '{ "upload": { "approach": "post", "redirect_url": "www.example.com" }}'
       headers = {
         'Authorization': 'Bearer <access_token>',
         'Content-Type': 'text/plain',
         'redirect_url': 'www.example.com'
       }

       response = requests.request("POST", url, headers=headers, data=payload)
       print(response.text.encode('utf8'))
       return Response(data=upload_data)

After uploading the video (which is successful) it just redirects to the default vimeo page. Tried countless variations, can't figure it out, has anyone done this?


Solution

  • 'Content-Type': 'text/plain'
    

    this should have been:

    'Content-Type': 'application/json'