我一直在尝试制作一个不和谐的网络钩子,但由于某种原因,我无法发送它来挽救我的生命。我在一个 json 文件中嵌入了所有的内容,并试图用 python 运行它。任何帮助将不胜感激。
json 文件:
{
"embeds": [
{
"title": "Title",
"color": 11393254,
"fields": [
{
"name": "Name1",
"value": "value1"
},
{
"name": "Name2",
"value": "value2",
"inline": true
},
],
"footer": {
"text": "Footer",
"icon_url": "random image url"
},
"timestamp": "now",
"thumbnail": {
"url": "random image url"
}
}
],
"username": "Username"
}
python 代码:
import requests, json
with open('webhook.json') as json_file:
data = json.load(json_file)
url = 'https://discord.com/api/webhooks/xxxxx'
headers={"Content-Type": "application/json"}
requests.post(url, data=json.dumps(data), headers=headers)
答案 0 :(得分:0)
您从 POST 返回的状态代码是什么?这可能是问题出在哪里的线索。