1

我有一个 django 应用程序,我在其中使用PyVimeo模块来连接和上传视频等,以Vimeo

发布区域数据的实际 vimeo api 在这里

例如,我有以下数据[{u'country_name': u'CA'}, {u'country_name': u'US'}]向 url 发送PUT请求https://api.vimeo.com/ondemand/pages/47753/regions

从我试图发送 PUT 请求的代码如下

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)

回应是400 Bad request

当按照 Vimeo API 文档中的说明按照以下方式尝试时

client.put(url + 'CA')

回复

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

但它没有反映在视频设置的分发部分中,并且Worldwide默认情况下

那么实际上如何将区域列表设置为点播页面 VOD 呢?

4

1 回答 1

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.

于 2015-08-31T15:48:13.127 回答