通过代理连接套接字

时间:2016-05-29 07:03:42

标签: python

我使用Socksipy,就像这样:

class SOCKS_POP3(poplib.POP3):
def __init__(self, host, port=poplib.POP3_PORT,timeout=socket._GLOBAL_DEFAULT_TIMEOUT,proxy_type = None, proxy = None):
    self.host = host
    self.port = port
    self.sock = socksocket()  
    if proxy and proxy_type:
        proxy_ip,proxy_port = proxy.split(':')
        self.sock.setproxy(proxy_type,proxy_ip,int(proxy_port))
    self.sock = socket.create_connection((host, port), timeout)
    self.file = self.sock.makefile('rb')
    self._debugging = 0
    self.welcome = self._getresp()

但是代理没有安装,它们会被忽略。我试图安装无法访问的代理,但没有错误。请告诉我为什么?

0 个答案:

没有答案