python - 当我运行获取请求时,我不断收到 AttributeError: 'set' object has no attribute 'items'?
问题描述
当我尝试使用请求库执行获取请求时,我不断收到错误消息:“AttributeError:'set' 对象没有属性'items'”。
下面显示了我已经尝试过的内容。
gethooks = "https://api.github.com/repos/ORGANIZATION/REPO/hooks"
response = requests.get(gethooks, headers={"Authorization: token GITHUBTOKEN"})
print(response)
我希望收到一个包含有关该 repos webhook 信息的 JSON,但会收到该错误。
解决方案
你忘了用逗号"token GITHUBTOKEN"
import requests
gethooks= "https://api.github.com/repos/ORGANIZATION/REPO/hooks"
headers={"Authorization": "token GITHUBTOKEN"}
response = requests.get(gethook, headers=headers)
print(response)
你应该试试看。它会给你结果
推荐阅读
- machine-learning - 优化具有长情节的深度 Q 网络
- java - 如何检查输入字符串是否是现有对象的名称?
- php - 如何在 Laravel 5.8 中正确翻译激活邮件?
- html5-canvas - 如何使用 Chart.js 为每个数据集设置不同的图例数据样式?
- python - 如何停止使用记事本打开 .whl 文件?
- c# - EDMX 文件和数据库中的更改
- javascript - 验证具有相同名称[]和不同行类别的输入
- google-apps-script - 我需要一个谷歌脚本在谷歌表格中运行以删除空白单元格右侧的单元格
- r - 更改堆叠条形图中的颜色
- c# - webservice WCF 上的 maxRequestLength 已超出