Google提供了使用可擴展消息和呈現協議(XMPP)發送GCM通知的python code sample。該指南沒有具體提及'import xmpp
'來自何處。然而這與xmpppy密切相關。使用Python XMPP的GCM通知
不幸的是,這個xmpppy項目似乎在很多年前就被拋棄了。最後一個版本是在2009年難怪有使用OpenSSL
Traceback (most recent call last):
File "google_ccs.py", line 54, in <module>
client.connect(server=(SERVER,PORT), secure=1, use_srv=False)
File "/usr/local/virtualenv-django18/local/lib/python2.7/site-packages/xmpp/client.py", line 200, in connect
if not CommonClient.connect(self,server,proxy,secure,use_srv) or secure<>None and not secure: return self.connected
File "/usr/local/virtualenv-django18/local/lib/python2.7/site-packages/xmpp/client.py", line 178, in connect
transports.TLS().PlugIn(self,now=1)
File "/usr/local/virtualenv-django18/local/lib/python2.7/site-packages/xmpp/transports.py", line 281, in PlugIn
if now: return self._startSSL()
File "/usr/local/virtualenv-django18/local/lib/python2.7/site-packages/xmpp/transports.py", line 316, in _startSSL
tcpsock._sslIssuer = tcpsock._sslObj.issuer()
AttributeError: '_ssl._SSLSocket' object has no attribute 'issuer'
的當前版本的這種特殊的堆棧跟蹤是在亞馬遜的Linux(2015年9月發佈)的不兼容性。的OpenSSL 1.0.1k-14.89.amzn1.x86_64。它也可以在其他發行版上看到。事實上,在其他具有xmpppy作爲依賴項目的項目中可以看到幾乎相同的堆棧跟蹤。這怎麼解決?
請檢查https://github.com/winster/xmppgcm – Winster