[PYTHON] With xmpppy'_ssl._SSLSocket' object has no attribute'issuer'

Somehow, when I try to communicate with xmpppy, it fails with an error in the title. The movement around SSL is strange. When you google [here](http://terminus.ignaciocano.com/k/2015/02/03/solucionado-el-error-attributeerror-_ssl-_sslsocket-object-has-no-attribute-issuer-en -Discovered ubuntu-utopic-unicorn /).

Does it seem like you can apply the patch? By the way, here is the version at hand

[sayamada@PyXmppClient]$pip freeze|grep xmpp
xmpppy==0.5.0rc1

--- xmpp/transports.py.orig	2010-04-06 21:05:04.000000000 +0800
+++ xmpp/transports.py	2010-04-06 21:05:20.000000000 +0800
@@ -27,7 +27,7 @@ Transports are stackable so you - f.e. T
 Also exception 'error' is defined to allow capture of this module specific exceptions.
 """
 
-import socket,select,base64,dispatcher,sys
+import socket,ssl,select,base64,dispatcher,sys
 from simplexml import ustr
 from client import PlugIn
 from protocol import *
@@ -312,9 +312,9 @@ class TLS(PlugIn):
         """ Immidiatedly switch socket to TLS mode. Used internally."""
         """ Here we should switch pending_data to hint mode."""
         tcpsock=self._owner.Connection
-        tcpsock._sslObj    = socket.ssl(tcpsock._sock, None, None)
-        tcpsock._sslIssuer = tcpsock._sslObj.issuer()
-        tcpsock._sslServer = tcpsock._sslObj.server()
+        tcpsock._sslObj    = ssl.wrap_socket(tcpsock._sock, None, None)
+        tcpsock._sslIssuer = tcpsock._sslObj.getpeercert().get('issuer')
+        tcpsock._sslServer = tcpsock._sslObj.getpeercert().get('server')
         tcpsock._recv = tcpsock._sslObj.read
         tcpsock._send = tcpsock._sslObj.write
 

So, when I guessed it, it was solved safely.

Recommended Posts

With xmpppy'_ssl._SSLSocket' object has no attribute'issuer'
AttributeError:'NoneType' object has no attribute'loader'
Blender has no object selection order
[Python] Attribute Error:'list' object has no attribute'replace'
When'DataFrame' object has no attribute'ix' appears in pandas
How to deal with module'tensorflow' has no attribute'〇〇'
Django "Query Set, Object has no attribute'foo'" solution
AttributeError: I was addicted to'module' object has no attribute'MyTestCase'
[Python] Countermeasures for "AttributeError:'NoneType' object has no attribute'group'" of googletrans