Пример #1
0
 def make_connection(self, host):
   try:
     if self._scheme == 'http':
       return Transport.make_connection(self, host)
     return SafeTransport.make_connection(self, host)
   except socket.error, e:
     raise ProtocolError(host, -1, "Could not connect to server", None)
Пример #2
0
    def make_connection(self, host):
        self.host = host
        if self.proxy:
            host = self.proxy.split('://', 1)[-1]
        if self.https:
            c = SafeTransport.make_connection(self, host)
        else:
            c = Transport.make_connection(self, host)

        c.timeout = self.timeout

        return c
 def make_connection(self, host):
     self.realhost = host
     proxies = urllib.getproxies()
     proxyurl = None
     if 'http' in proxies:
         proxyurl = proxies['http']
     elif 'all' in proxies:
         proxyurl = proxies['all']
     if proxyurl:
         urltype, proxyhost = urllib.splittype(proxyurl)
         host, selector = urllib.splithost(proxyhost)
         h = httplib.HTTP(host)
         self.proxy_is_used = True
         return h
     else:
         self.proxy_is_used = False
         return Transport.make_connection(self, host)
Пример #4
0
 def make_connection(self, host):
     self.realhost = host
     proxies = urllib.getproxies()
     proxyurl = None
     if 'http' in proxies:
         proxyurl = proxies['http']
     elif 'all' in proxies:
         proxyurl = proxies['all']
     if proxyurl:
         urltype, proxyhost = urllib.splittype(proxyurl)
         host, selector = urllib.splithost(proxyhost)
         h = httplib.HTTP(host)
         self.proxy_is_used = True
         return h
     else:
         self.proxy_is_used = False
         return Transport.make_connection(self, host)
Пример #5
0
 def make_connection(self, host):
     """Create the connection for the transport and save it."""
     self.conn = Transport.make_connection(self, host)
     return self.conn
Пример #6
0
    def make_connection(self, host):
        c = Transport.make_connection(self, host)
        c.timeout = self.timeout

        return c
Пример #7
0
 def make_connection(self, host):
     """Create the connection for the transport and save it."""
     self.conn = Transport.make_connection(self, host)
     return self.conn
Пример #8
0
 def make_connection(self, host):    
     conn = Transport.make_connection(self, host)
     conn.timeout = self._timeout
     return conn
Пример #9
0
 def make_connection(self, host):
     conn = Transport.make_connection(self, host)
     if self.timeout:
         conn.timeout = self.timeout
     return conn