python - 使用 YouTube Data API v3 更新视频标题会给出“消息”:“解析错误”
问题描述
我正在尝试使用带有 python 的 YouTube API V3 更改视频标题。我正在使用requests
模块发送一个 put 请求。这是我的代码:
import requests
url = "https://www.googleapis.com/youtube/v3/videos?part=snippet&key=[KEY] HTTP/1.1"
headers= {
'Authorization': 'Bearer [ACCESS_KEY]',
'Accept': 'application/json',
'Content-Type': 'application/json',
}
data = {
'id': 'azTrAGHcPX4',
'snippet': {
'title': 'This video has views',
'categoryId': '22',
}
}
json = requests.put(url,headers=headers,data=data)
上print(json)
,我收到以下错误:
{'error': {'errors': [{'domain': 'global', 'reason': 'parseError', 'message': 'Parse Error'}], 'code': 400, 'message': 'Parse Error'}}
关于这个错误的任何线索?
解决方案
推荐阅读
- java - 启动 SQLWorkbench/J 时出现“无法加载 Java 运行时环境”
- c++ - C++ CMake 编译指令与?
- rest - Clockify - 将所有数据导入 excel 或使用 REST api 访问的最佳方式?
- javascript - 有没有办法可以在链接标签中引用本地 const 文件
- bootstrap-4 - 为什么引导程序中不存在 bd-navbar
- cmake - cmake_configuration_types 和 3rd 方库
- c# - ORACLE & VS 2005 性能问题
- excel - Excel:条件格式列或整行内的更多(文本)实例
- java - 我在Java中做错了什么?(简单的问题)
- windows - NSIS 安装程序应用程序名称未正确显示