import requests
import json
# https://github.com/hipchat/pusher , twistd pusher --apns-cert=prod-cert.pem --apns-key=prod-key.pem
# curl http://localhost:2196/send -d "deviceToken=<your token>&payload={\"aps\":{\"alert\":\"Testing Pusher\"}}"
MAX_PAYLOAD_LEN = 256
base_url = 'http://localhost:2196/send'
device_token = '99ed7cbcb32764bff208fd66ba90b81abiosdeviceid' # John iOS 5
headers = dict()
aps = { 'alert': 'John Says', 'badge': 42}
payload = {'aps': aps }
json_body = json.dumps(payload)
print json_body
parameters = {'deviceToken': device_token, 'payload': json_body}
print parameters
response = requests.post(base_url , headers=headers, params=parameters)
print response.status_code # should return 200
print response.headers
print response.text # should return QUEUED
print 'done'