如何解决Python OneSignal返回400错误请求
嗨,我有以下代码:
import requests
import json
header = {"Content-Type": "application/json; charset=utf-8","Authorization": "Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj"}
payload = {"app_id": "APP ID HERE","included_segments": ["Active Users"],"contents": {"en": "This is a test message from python"}}
req = requests.post("https://onesignal.com/api/v1/notifications",headers=header,data=json.dumps(payload))
print(req.status_code,req.reason)
我输入了正确的APP ID,但是当我运行代码时,出现以下错误:
400错误的请求
请有人告诉我我要去哪里错了。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。