Google provides a python code sample for sending GCM notifications using the Extensible Messaging and Presence Protocol (XMPP). The guide doesn't specifically mention where the '
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
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'
The first solution is to patch
xmpp/transports.py the patch comes from free-bsd but works on linux.
The second solution is to switch to a fork of xmpppy that does not have this issue. You can install it as follows.
source /myvirtualenv/bin/activate/ pip uninstall xmpppy wget https://github.com/ArchipelProject/xmpppy/archive/master.zip tar -xvf master cd xmpppy-master python setup.py build python setup.py install
Now the SSL error goes disappears. You can be happy with the knowledge that you are using code that was last updated 2 years ago instead of seven years ago! This solution works for any project that has xmpppy as a dependency and isn't just limited to GCM.
Both solutions were discovered in an Eventlet bug report.
update: You can even use pip to install the fork.
pip install https://github.com/ArchipelProject/xmpppy/archive/master.zip