python - 错误的请求 | 不和谐 api v8
问题描述
代码:
headers = {"authorization": f"{config['token']}","Content-Type":"application/json"}
data1 = {"recipients":[f"{member.id}"]}
r1 = requests.request("POST", f"https://discord.com/api/v8/users/{ctx.author.id}/channels", headers=headers, data=data1)
我收到错误的请求错误,代码:0
这些值中的每一个都像 member.id 一样存在。没有 NoneType
解决方案
实际的授权标头具有以下格式:
Authorization: Bot TOKEN
因此,您需要将标题更改为
headers = {"Authorization": f"Bot {config['token']}", ...}
推荐阅读
- python - 在matplotlib中处理按键事件时如何保留默认键盘快捷键
- vba - 我需要我的程序复制 3 个单元格并将其作为图片粘贴到下一张纸上。我需要它对列表中的每一行重复此操作
- excel - 有没有办法将(excel屏幕剪辑按钮程序)分配给用户窗体命令按钮?
- jinja2 - DBT 宏忽略前导 if 块
- ssh - Mobaxterm:通过 SSH 网关连接(跳转主机)给出错误为“远程端意外关闭网络连接”
- kotlin - Kotlin 内部类无法解析外部类中声明的扩展函数
- iot - 谷歌主页。关于配置锁定设备的问题
- typescript - 如果字段未设置值,prisma postgresql 无法设置未定义
- json - 反对在客户端创建 JWT 的论据
- javascript -
在我的 Nuxt js 应用程序中毁掉我的 CSS