我从android应用程序中解析了解析中的deviceId。
import json,httplib
connection = httplib.HTTPSConnection('api.parse.com', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"where": {
"deviceId": 22
},
"data": {
"alert": "Yo baby ... ."
}
}), {
"X-Parse-Application-Id": "aaa",
"X-Parse-REST-API-Key": "bbb",
"Content-Type": "application/json"
})
result = json.loads(connection.getresponse().read())
print result['result']
connection.close()
我总是得到真实的结果。我如何知道是否已发送推送通知,或者是否已将推送通知发送到该设备。
答案 0 :(得分:1)
检查the documentation (Section 20.7.3. Examples)。
我可以告诉您,您必须检查status
connection.getresponse()
是否返回2xx
代码(more here),如果是,则POST是成功的,如果不是,您很可能会收到5xx
或4xx
代码。
希望这会有所帮助:)