【发布时间】:2015-12-29 22:19:42
【问题描述】:
我正在尝试通过 Parse 将推送通知从我们的 python 后端发送到 iOS 移动应用程序。 iOS 端的所有内容都已配置,但是当我向 Parse API 发出请求时,我收到了 401 Unauthorized 响应。
headers = {'X-Parse-REST-API-Key': 'MY_API_KEY', 'X-Parse-Master-Key': 'MY_MASTER_KEY', 'Content-Type': 'content/json', 'X-Parse-Application-Id': 'MY_APPLICATION_ID'}
params = {'channels': ['general'], 'data': {'alert': 'Test push'}}
url = 'http://api.parse.com/1/push'
r = requests.post(url, params = params, headers = headers)
print r.status_code
>> 401
【问题讨论】:
-
r.text说什么? -
u'{"error":"unauthorized"}\n' -
这个标题是
X-Parse-Application-Id,应该是别的吗?
标签: python ios rest parse-platform python-requests