开发者

pyapns - hexlified_token_str

i try to test pyapns.

There is a mention of the hexlified_token_str in the documentation. My token is stored in base64 format.

I try to do this

>>> notify('myapp', base64.decodestring('Sl96FJtZbZDZECSP3EedQJbsXdtlV+LXWd4+jbzvbHM='), {'aps':{'alert': 'Hello!'}})

But I'm wrong.

Traceback (most recent call last):
  File "&l开发者_C百科t;stdin>", line 1, in <module>
  File "build/bdist.linux-i686/egg/pyapns/client.py", line 54, in notify
  File "build/bdist.linux-i686/egg/pyapns/client.py", line 76, in _xmlrpc_thread
  File "/usr/lib/python2.5/xmlrpclib.py", line 1147, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.5/xmlrpclib.py", line 1437, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.5/xmlrpclib.py", line 1201, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.5/xmlrpclib.py", line 1340, in _parse_response
    return u.close()
  File "/usr/lib/python2.5/xmlrpclib.py", line 787, in close
    raise Fault(**self._stack[0])
  xmlrpclib.Fault: <Fault 8002: "Can't deserialize input: not well-formed (invalid token): line 9, column 18">

How do I do hexlified it correctly ?


It was too late yesterday ... It did the job :

binascii.hexlify(base64.decodestring('Sl96FJtZbZDZECSP3EedQJbsXdtlV+LXWd4+jbzvbHM='))

It was just an obsolete token !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜