New iOS token based notification - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Networking (https://python-forum.io/forum-12.html) +--- Thread: New iOS token based notification (/thread-2288.html) |
New iOS token based notification - fbartolom - Mar-04-2017 I am trying to implement the new iOS token based notifications and for this I found a tutorial named: "token-based-authentication-http2-example-apns" that I implemented starting with: import json import jwt import time from hyper import HTTPConnection ALGORITHM = 'ES256' APNS_KEY_ID = 'H6Q3X7RYZG' APNS_AUTH_KEY = 'APNsAuthKey_H6Q3X7RYZG.p8' TEAM_ID = 'GF9PQ87F68' REGISTRATION_ID = '713d3a9f4d932ac824caf9373a2f182b2dfa710fb7b6214e3bd405ae1e32d0aa' BUNDLE_ID = 'com.meditation.iPujaPro' f = open(APNS_AUTH_KEY) secret = f.read() print(secret) token = jwt.encode( { 'iss': TEAM_ID, 'iat': time.time() }, secret, algorithm = ALGORITHM, headers={ 'alg': ALGORITHM, 'kid': APNS_KEY_ID } )Yet when I run it I get: If I remove the part after secret I have no error there and of course later. What might it be the problem or is there an alternative solution to implement the thing?
|