pyapns - hexlified_token_str

发布于 2024-09-25 07:02:05 字数 1232 浏览 5 评论 0原文

我尝试测试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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

早茶月光 2024-10-02 07:02:05

昨天已经太晚了...
它完成了任务:

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

这只是一个过时的令牌!

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

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

It was just an obsolete token !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文