pyapns - hexlified_token_str
我尝试测试pyapns。
文档中提到了 hexlified_token_str。 我的令牌以 base64 格式存储。
我尝试这样做,
>>> notify('myapp', base64.decodestring('Sl96FJtZbZDZECSP3EedQJbsXdtlV+LXWd4+jbzvbHM='), {'aps':{'alert': 'Hello!'}})
但我错了。
Traceback (most recent call last):
File "<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">
我如何正确地对其进行十六进制化?
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 "<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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
昨天已经太晚了...
它完成了任务:
这只是一个过时的令牌!
It was too late yesterday ...
It did the job :
It was just an obsolete token !