1

I have a django app in which i am using PyVimeo module to connect and upload videos etc., to Vimeo

The actual vimeo api to post the region data was here

For example i have the following data [{u'country_name': u'CA'}, {u'country_name': u'US'}] to send a PUT request to the url https://api.vimeo.com/ondemand/pages/47753/regions

From code i was trying to send PUT request as below

import vimeo

token = XXXXXXXXXXXXXXXXXX
VIMEO_KEY = XXXXXXXXXXXXXXXXXX
VIMEO_SECRET = XXXXXXXXXXXXXXXXXX
client = vimeo.VimeoClient(key=VIMEO_KEY, secret=VIMEO_SECRET, token=token)

url = https://api.vimeo.com/ondemand/pages/47753/regions
regions_data = [{u'country_name': u'CA'}, {u'country_name': u'US'}]

result_data = client.put(url, regions_data)

Response was 400 Bad request

When tried in the below way as indicated in the Vimeo API docs

client.put(url + 'CA')

Response

HTTP/1.1 201
Location: Array
Host: api.vimeo.com

But it was not reflecting in the Distribution section of the video setting and being as Worldwide by default

So how actually to set a list of regions to a on demand page VOD ?

Shiva Krishna Bavandla
  • 25,548
  • 75
  • 193
  • 313
  • The batch PUT to https://api.vimeo.com/ondemand/pages/47753/regions looks correct, I'll have to dig into why that's not working. The PUT to a single region only enables that region. It will not disable other regions, so since you are available worldwide, the region is already enabled and you will see no change. – Dashron Aug 27 '15 at 13:46
  • @Dashron Thanks very much for replying, yeah we are really facing the problem with Vimeo Client to post the territories, by the way it was working from postman when use raw data with content type as application/json – Shiva Krishna Bavandla Aug 31 '15 at 13:42

1 Answers1

0

Try setting country_code instead of country_name

v = vimeo.VimeoClient(key=YOUR_VIMEO_KEY,
                      secret=YOUR_VIMEO_SECRET,
                      token=YOUR_VIMEO_TOKEN)

regions_data = [{'country_code': 'CA'}, {'country_code': 'US'}]

output = v.put('/ondemand/pages/mytestvod/regions', data=regions_data)

This should restrict distribution to only Canada and the US.