日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python视频网站分类_媒资分类_Python SDK_服务端SDK_视频点播 - 阿里云

發(fā)布時(shí)間:2024/7/23 python 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python视频网站分类_媒资分类_Python SDK_服务端SDK_视频点播 - 阿里云 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

初始化客戶端

使用前請(qǐng)先初始化客戶端,請(qǐng)參見

創(chuàng)建分類

調(diào)用AddCategory接口,完成創(chuàng)建分類功能。

接口參數(shù)和返回字段請(qǐng)參見from aliyunsdkvod.request.v20170321 import AddCategoryRequest

def add_category(clt, cateName, parentId=-1):

request = AddCategoryRequest.AddCategoryRequest()

request.set_CateName(cateName)

request.set_ParentId(parentId)

request.set_accept_format('JSON')

response = json.loads(clt.do_action_with_exception(request))

return response

try:

clt = init_vod_client('', '')

addRes = add_category(clt, 'Category Name')

print(json.dumps(addRes, ensure_ascii=False, indent=4))

except Exception as e:

print(e)

print(traceback.format_exc())

修改分類

調(diào)用UpdateCategory接口,完成修改分類功能。

接口參數(shù)和返回字段請(qǐng)參見from aliyunsdkvod.request.v20170321 import UpdateCategoryRequest

def update_category(clt, cateId, cateName):

request = UpdateCategoryRequest.UpdateCategoryRequest()

request.set_CateId(cateId)

request.set_CateName(cateName)

request.set_accept_format('JSON')

response = json.loads(clt.do_action_with_exception(request))

return response

try:

clt = init_vod_client('', '')

updateRes = update_category(clt, '', 'New Category Name')

print(json.dumps(updateRes, ensure_ascii=False, indent=4))

except Exception as e:

print(e)

print(traceback.format_exc())

刪除分類

調(diào)用DeleteCategory接口,完成刪除分類功能。

接口參數(shù)和返回字段請(qǐng)參見from aliyunsdkvod.request.v20170321 import UpdateCategoryRequest

# 刪除視頻分類,同時(shí)會(huì)刪除其下級(jí)分類(包括二級(jí)分類和三級(jí)分類),請(qǐng)慎重操作

def delete_category(clt, cateId):

request = DeleteCategoryRequest.DeleteCategoryRequest()

request.set_CateId(cateId)

request.set_accept_format('JSON')

response = json.loads(clt.do_action_with_exception(request))

return response

try:

clt = init_vod_client('', '')

delRes = delete_category(clt, '')

print(json.dumps(delRes, ensure_ascii=False, indent=4))

except Exception as e:

print(e)

print(traceback.format_exc())

查詢分類及其子分類

調(diào)用GetCategories接口,完成查詢分類及其子分類功能。

接口參數(shù)和返回字段請(qǐng)參見from aliyunsdkvod.request.v20170321 import GetCategoriesRequest

def get_categories(clt, cateId=-1, pageNo=1, pageSize=10):

request = GetCategoriesRequest.GetCategoriesRequest()

request.set_CateId(cateId)

request.set_PageNo(pageNo)

request.set_PageSize(pageSize)

request.set_accept_format('JSON')

response = json.loads(clt.do_action_with_exception(request))

return response

try:

clt = init_vod_client('', '')

getRes = get_categories(clt, '')

print(json.dumps(getRes, ensure_ascii=False, indent=4))

except Exception as e:

print(e)

print(traceback.format_exc())

總結(jié)

以上是生活随笔為你收集整理的python视频网站分类_媒资分类_Python SDK_服务端SDK_视频点播 - 阿里云的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。