(self, destpair)
connect(self, despair)
        Connects to the specified destination through a proxy.
        destpar - A tuple of the IP/DNS address and the port number.
        (identical to socket's connect).
        To select the proxy server use setproxy().
connect(self, despair)
        Connects to the specified destination through a proxy.
        destpar - A tuple of the IP/DNS address and the port number.
        (identical to socket's connect).
        To select the proxy server use setproxy().
connect ( self despair ) Connects to the specified destination through a proxy . destpar - A tuple of the IP / DNS address and the port number . ( identical to socket s connect ) . To select the proxy server use setproxy () .
def connect(self, destpair):
        """connect(self, despair)
        Connects to the specified destination through a proxy.
        destpar - A tuple of the IP/DNS address and the port number.
        (identical to socket's connect).
        To select the proxy server use setproxy().
        """
        # Do a minimal input check first
        if (not type(destpair) in (list,tuple)) or (len(destpair) < 2) or (not isinstance(destpair[0], basestring)) or (type(destpair[1]) != int):
            raise GeneralProxyError((5, _generalerrors[5]))
        if self.__proxy[0] == PROXY_TYPE_SOCKS5:
            if self.__proxy[2] != None:
                portnum = self.__proxy[2]
            else:
                portnum = 1080
            _orgsocket.connect(self, (self.__proxy[1], portnum))
            self.__negotiatesocks5(destpair[0], destpair[1])
        elif self.__proxy[0] == PROXY_TYPE_SOCKS4:
            if self.__proxy[2] != None:
                portnum = self.__proxy[2]
            else:
                portnum = 1080
            _orgsocket.connect(self,(self.__proxy[1], portnum))
            self.__negotiatesocks4(destpair[0], destpair[1])
        elif self.__proxy[0] == PROXY_TYPE_HTTP:
            if self.__proxy[2] != None:
                portnum = self.__proxy[2]
            else:
                portnum = 8080
            _orgsocket.connect(self,(self.__proxy[1], portnum))
            self.__negotiatehttp(destpair[0], destpair[1])
        elif self.__proxy[0] == PROXY_TYPE_HTTP_NO_TUNNEL:
            if self.__proxy[2] != None:
                portnum = self.__proxy[2]
            else:
                portnum = 8080
            _orgsocket.connect(self,(self.__proxy[1],portnum))
            if destpair[1] == 443:
                self.__negotiatehttp(destpair[0],destpair[1])
            else:
                self.__httptunnel = False
        elif self.__proxy[0] == None:
            _orgsocket.connect(self, (destpair[0], destpair[1]))
        else:
            raise GeneralProxyError((4, _generalerrors[4]))
def connect ( self , destpair ) : # Do a minimal input check first if ( not type ( destpair ) in ( list , tuple ) ) or ( len ( destpair ) < 2 ) or ( not isinstance ( destpair [ 0 ] , basestring ) ) or ( type ( destpair [ 1 ] ) != int ) : raise GeneralProxyError ( ( 5 , _generalerrors [ 5 ] ) ) if self . __proxy [ 0 ] == PROXY_TYPE_SOCKS5 : if self . __proxy [ 2 ] != None : portnum = self . __proxy [ 2 ] else : portnum = 1080 _orgsocket . connect ( self , ( self . __proxy [ 1 ] , portnum ) ) self . __negotiatesocks5 ( destpair [ 0 ] , destpair [ 1 ] ) elif self . __proxy [ 0 ] == PROXY_TYPE_SOCKS4 : if self . __proxy [ 2 ] != None : portnum = self . __proxy [ 2 ] else : portnum = 1080 _orgsocket . connect ( self , ( self . __proxy [ 1 ] , portnum ) ) self . __negotiatesocks4 ( destpair [ 0 ] , destpair [ 1 ] ) elif self . __proxy [ 0 ] == PROXY_TYPE_HTTP : if self . __proxy [ 2 ] != None : portnum = self . __proxy [ 2 ] else : portnum = 8080 _orgsocket . connect ( self , ( self . __proxy [ 1 ] , portnum ) ) self . __negotiatehttp ( destpair [ 0 ] , destpair [ 1 ] ) elif self . __proxy [ 0 ] == PROXY_TYPE_HTTP_NO_TUNNEL : if self . __proxy [ 2 ] != None : portnum = self . __proxy [ 2 ] else : portnum = 8080 _orgsocket . connect ( self , ( self . __proxy [ 1 ] , portnum ) ) if destpair [ 1 ] == 443 : self . __negotiatehttp ( destpair [ 0 ] , destpair [ 1 ] ) else : self . __httptunnel = False elif self . __proxy [ 0 ] == None : _orgsocket . connect ( self , ( destpair [ 0 ] , destpair [ 1 ] ) ) else : raise GeneralProxyError ( ( 4 , _generalerrors [ 4 ] ) )