class SOCKS_IMAP4_SSL(imaplib.IMAP4_SSL):
def __init__(self, host, port = imaplib.IMAP4_SSL_PORT, proxy_type = None, proxy = None,):
self.proxy = proxy
self.proxy_type = proxy_type
imaplib.IMAP4_SSL.__init__(self, host, port)
def open(self, host, port = imaplib.IMAP4_SSL_PORT):
self.host = host
self.port = port
if self.proxy and self.proxy_type:
proxy_ip, proxy_port = self.proxy.split(':')
self.sock = socks.create_connection((host, port), self.proxy_type, proxy_ip, int(proxy_port))
else:
self.sock = socket.create_connection((host, port))
self.sslobj = ssl.wrap_socket(self.sock, self.keyfile, self.certfile)
self.file = self.sslobj.makefile('rb')
При подключении, через сокс выдает ошибку:
SSLEOFError: EOF occurred in violation of protocol (_ssl.c:590)
В чем может быть проблема?