def __init__(self, host, port=None, strict=None, connection_timeout=60): if sys.version < "3.4": HTTPConnection.__init__(self, host, port, strict) else: HTTPConnection.__init__(self, host, port) self.request_length = 0 self.connection_timeout = connection_timeout
def __init__(self, host, port=None, *args, **kwargs): if (port is None): port = 80 HTTPConnection.__init__(self, host, port, *args, **kwargs) self.req_string = b'' self.__host = host self.__port = port
def __init__(self, *args, **kwargs): self.ssl_wrap_args = {'server_side': False} for i in ['keyfile', 'certfile', 'ca_certs', 'cert_reqs']: if i in kwargs: self.ssl_wrap_args[i] = kwargs[i] del kwargs[i] HTTPConnection.__init__(self, *args, **kwargs)
def __init__(self, host, port=None, key_file=None, cert_file=None, strict=_strict_sentinel, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None, *, context=None, check_hostname=None): # The original line as of Python 3.2 reads: # super(HTTPSConnection, self).__init__(host, port, strict, timeout, # source_address) # We modify it to call the subclass directly to avoid a recursion error. HTTPConnection.__init__(self, host, port, strict, timeout, source_address) self.key_file = key_file self.cert_file = cert_file if context is None: # Some reasonable defaults context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.options |= ssl.OP_NO_SSLv2 will_verify = context.verify_mode != ssl.CERT_NONE if check_hostname is None: check_hostname = will_verify elif check_hostname and not will_verify: raise ValueError("check_hostname needs a SSL context with " "either CERT_OPTIONAL or CERT_REQUIRED") if key_file or cert_file: context.load_cert_chain(cert_file, key_file) self._context = context self._check_hostname = check_hostname
def __init__(self, host, port=None, key_file=None, cert_file=None, strict=_strict_sentinel, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None, *, context=None, check_hostname=None): # The original line as of Python 3.2 reads: # super(HTTPSConnection, self).__init__(host, port, strict, timeout, # source_address) # We modify it to call the subclass directly to avoid a recursion error. HTTPConnection.__init__(self, host, port, strict, timeout, source_address) self.key_file = key_file self.cert_file = cert_file if context is None: # Some reasonable defaults context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.options |= ssl.OP_NO_SSLv2 will_verify = context.verify_mode != ssl.CERT_NONE if check_hostname is None: check_hostname = will_verify elif check_hostname and not will_verify: raise ValueError("check_hostname needs a SSL context with " "either CERT_OPTIONAL or CERT_REQUIRED") if key_file or cert_file: context.load_cert_chain(cert_file, key_file) self._context = context self._check_hostname = check_hostname
def __init__(self, host, port=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, connect_timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None): _HTTPConnection.__init__(self, host, port=port, strict=strict, timeout=timeout) self.source_address = source_address self.connect_timeout = connect_timeout
def __init__(self, *args, **kw): if six.PY3: # Python 3 kw.pop('strict', None) if sys.version_info < (2, 7): # Python 2.6 and earlier kw.pop('source_address', None) self.source_address = None _HTTPConnection.__init__(self, *args, **kw)
def __init__(self, *args, **kw): if six.PY3: # Python 3 kw.pop('strict', None) if sys.version_info < (2, 7): # Python 2.6 and earlier kw.pop('source_address', None) self.source_address = None _HTTPConnection.__init__(self, *args, **kw)
def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, **kwargs): self.passwd = kwargs.get('passwd') # Python 2.6.1 on OS X 10.6 does not include these self._tunnel_host = None self._tunnel_port = None self._tunnel_headers = {} HTTPConnection.__init__(self, host, port=port, timeout=timeout)
def __init__(self, proxytype, proxyaddr, proxyport=None, rdns=True, username=None, password=None, *args, **kwargs): self._proxyargs = (proxytype, proxyaddr, proxyport, rdns, username, password) HTTPConnection.__init__(self, *args, **kwargs)
def __init__(self, *args, **kw): if six.PY3: # Python 3 kw.pop('strict', None) if sys.version_info < (2, 7): # Python 2.6 and older kw.pop('source_address', None) # Pre-set source_address in case we have an older Python like 2.6. self.source_address = kw.get('source_address') # Superclass also sets self.source_address in Python 2.7+. _HTTPConnection.__init__(self, *args, **kw)
def __init__(self, path, *args, **kwargs): """ Constructs the HTTP connection. Forwards all given arguments except ``path`` to the constructor of HTTPConnection :param path: Path to the Unix socket """ HTTPConnection.__init__(self, path, *args, **kwargs) self.path = path
def __init__(self, *args, **kw): if six.PY3: # Python 3 kw.pop('strict', None) if sys.version_info < (2, 7): # Python 2.6 and older kw.pop('source_address', None) # Pre-set source_address in case we have an older Python like 2.6. self.source_address = kw.get('source_address') # Superclass also sets self.source_address in Python 2.7+. _HTTPConnection.__init__(self, *args, **kw)
def __init__(self, path, *args, **kwargs): """ Constructs the HTTP connection. Forwards all given arguments except ``path`` to the constructor of HTTPConnection :param path: Path to the Unix socket """ HTTPConnection.__init__(self, path, *args, **kwargs) self.path = path
def __init__(self, *args, **kw): if six.PY3: # Python 3 kw.pop('strict', None) if sys.version_info < (2, 7): # Python 2.6 and older if kw.pop('source_address', None): warnings.warn(SOURCE_ADDRESS_WARNING, PythonVersionWarning) # Pre-set source_address in case we have an older Python like 2.6. self.source_address = kw.get('source_address') # Superclass also sets self.source_address in Python 2.7+. _HTTPConnection.__init__(self, *args, **kw)
def __init__(self, proxytype, proxyaddr, proxyport=None, rdns=True, username=None, password=None, *args, **kwargs): self.proxyargs = (proxytype, proxyaddr, proxyport, rdns, username, password) HTTPConnection.__init__(self, *args, **kwargs)
def __init__(self, host, port=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, ssl_context=None): HTTPConnection.__init__(self, host, port, strict, timeout) if not hasattr(self, 'ssl_context'): self.ssl_context = None if ssl_context is not None: if not isinstance(ssl_context, SSL.Context): raise TypeError('Expecting OpenSSL.SSL.Context type for "' 'ssl_context" keyword; got %r instead' % ssl_context) self.ssl_context = ssl_context
def __init__(self, host, port=None, timeout=60, proxy=None): self.request_length = 0 self.has_proxy = False self.request_host = host proxy = proxy or _get_proxy_from_env(host, varname="HTTP_PROXY") if proxy: url = urlparse(proxy) if not url.hostname: url = urlparse('http://' + proxy) host = url.hostname port = url.port self.has_proxy = True HTTPConnection.__init__(self, host, port, timeout=timeout)
def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, **kwargs): self.passwd = kwargs.get('passwd') # Python 2.6.1 on OS X 10.6 does not include these self._tunnel_host = None self._tunnel_port = None self._tunnel_headers = {} if 'debug' in kwargs and kwargs['debug']: self.debuglevel = 5 elif 'debuglevel' in kwargs: self.debuglevel = kwargs['debuglevel'] HTTPConnection.__init__(self, host, port=port, timeout=timeout)
def __init__(self, *args, **kw): # Pre-set source_address. self.source_address = kw.get("source_address") #: The socket options provided by the user. If no options are #: provided, we use the default options. self.socket_options = kw.pop("socket_options", self.default_socket_options) # Proxy options provided by the user. self.proxy = kw.pop("proxy", None) self.proxy_config = kw.pop("proxy_config", None) _HTTPConnection.__init__(self, *args, **kw)
def __init__(self, host, port=None, timeout=60, proxy=None): self.request_length = 0 self.has_proxy = False self.request_host = host proxy = proxy or os.environ.get('http_proxy') or os.environ.get( 'HTTP_PROXY') if proxy: url = urlparse(proxy) if not url.hostname: url = urlparse('http://' + proxy) host = url.hostname port = url.port self.has_proxy = True HTTPConnection.__init__(self, host, port, timeout=timeout)
def __init__(self, path, *args, **kwargs): """ Constructs the HTTP connection. Forwards all given arguments except ``path`` to the constructor of HTTPConnection :param path: Path to the Unix socket """ # Use localhost as the hostname since a HTTP/1.1 client MUST send a # 'Host:' header. HTTPConnection.__init__(self, 'localhost', *args, **kwargs) self.path = path
def __init__( self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None, ): HTTPConnection.__init__(self, host, port, strict, timeout, source_address) self.key_file = key_file self.cert_file = cert_file
def __init__(self, host, port=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, ssl_context=None): HTTPConnection.__init__(self, host, port, strict, timeout) if not hasattr(self, 'ssl_context'): self.ssl_context = None if ssl_context is not None: if not isinstance(ssl_context, SSL.Context): raise TypeError('Expecting OpenSSL.SSL.Context type for "' 'ssl_context" keyword; got %r instead' % ssl_context) self.ssl_context = ssl_context
def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, **kwargs): self.passwd = kwargs.get('passwd') # Python 2.6.1 on OS X 10.6 does not include these self._tunnel_host = None self._tunnel_port = None self._tunnel_headers = {} if 'debug' in kwargs and kwargs['debug']: self.debuglevel = 5 elif 'debuglevel' in kwargs: self.debuglevel = kwargs['debuglevel'] HTTPConnection.__init__(self, host, port=port, timeout=timeout)
def __init__(self, link, retry=5): self.retry = retry try: r = HTTP_STRIP_PATTERN.search(link) if r: r = URL_PATTERN.search(r.group(1)) else: r = URL_PATTERN.search(link) self.main, self.page = r.group(1), r.group(4) except AttributeError: raise Exception("Invalid URL - ", link) except IndexError: raise Exception("Invalid URL - ", link) except Exception as e: raise Exception("HTTPGetRequest: ", e) HTTPConnection.__init__(self, self.main, 80) self.request("GET", self.page, headers=headers)
def __init__(self, link, retry=5): self.retry = retry try: r = HTTP_STRIP_PATTERN.search(link) if r: r = URL_PATTERN.search(r.group(1)) else: r = URL_PATTERN.search(link) self.main, self.page = r.group(1), r.group(4) except AttributeError: raise Exception("Invalid URL - ", link) except IndexError: raise Exception("Invalid URL - ", link) except Exception as e: raise Exception("HTTPGetRequest: " , e) HTTPConnection.__init__(self, self.main, 80) self.request("GET", self.page, headers=headers)
def __init__(self, *args, **kw): if six.PY3: # Python 3 kw.pop('strict', None) # Pre-set source_address in case we have an older Python like 2.6. self.source_address = kw.get('source_address') if sys.version_info < (2, 7): # Python 2.6 # _HTTPConnection on Python 2.6 will balk at this keyword arg, but # not newer versions. We can still use it when creating a # connection though, so we pop it *after* we have saved it as # self.source_address. kw.pop('source_address', None) #: The socket options provided by the user. If no options are #: provided, we use the default options. self.socket_options = kw.pop('socket_options', self.default_socket_options) # Superclass also sets self.source_address in Python 2.7+. _HTTPConnection.__init__(self, *args, **kw)
def __init__(self, *args, **kw): if six.PY3: # Python 3 kw.pop('strict', None) # Pre-set source_address in case we have an older Python like 2.6. self.source_address = kw.get('source_address') if sys.version_info < (2, 7): # Python 2.6 # _HTTPConnection on Python 2.6 will balk at this keyword arg, but # not newer versions. We can still use it when creating a # connection though, so we pop it *after* we have saved it as # self.source_address. kw.pop('source_address', None) #: The socket options provided by the user. If no options are #: provided, we use the default options. self.socket_options = kw.pop('socket_options', self.default_socket_options) # Superclass also sets self.source_address in Python 2.7+. _HTTPConnection.__init__(self, *args, **kw)
def __init__(self, host, port=None, timeout=20): HTTPConnection.__init__(self, host, port) self.timeout = timeout
def __init__(self, host, port=None, strict=None): if sys.version < "3.4": HTTPSConnection.__init__(self, host, port, strict=strict) else: HTTPConnection.__init__(self, host, port) self.request_length = 0
def __init__(self, path): HTTPConnection.__init__(self, 'localhost') self.path = path
def __init__(self, host, port=None, timeout=20): HTTPConnection.__init__(self, host, port) self.timeout = timeout
def __init__(self, path, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.path = path HTTPConnection.__init__(self, "localhost", timeout=timeout)
def __init__(self, host, port=None, strict=None, connection_timeout=60): HTTPConnection.__init__(self, host, port) self.request_length = 0 self.connection_timeout = connection_timeout
def __init__(self, host, port=None, strict=None, timeout=None): HTTPConnection.__init__(self, host, port, strict) self._timeout = timeout
def __init__(self, rfile, wfile): HTTPConnection.__init__(self, 'localhost') self.rfile = rfile self.wfile = wfile
def __init__(self, path, timeout=60): HTTPConnection.__init__(self, 'localhost') self.path = path self.timeout = timeout
def __init__(self, host, port=None, strict=None, connection_timeout=60): HTTPConnection.__init__(self, host, port, strict) self.request_length = 0 self.connection_timeout = connection_timeout
def __init__(self, host, port=None, context=None, client_certificate=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, **kwargs): HTTPConnection.__init__(self, host, port, strict, timeout) self._client_certificate = client_certificate self._context = context
def __init__(self, path, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.path = path HTTPConnection.__init__(self, "localhost", timeout=timeout)
def __init__(self, path, timeout=60): HTTPConnection.__init__(self, 'localhost') self.path = path self.timeout = timeout
def __init__(self, *args, **kwargs): HTTPConnection.__init__(self, *args, **kwargs)
def __init__(self, host, port, environ): self.environ = environ HTTPConnection.__init__(host, port)
def __init__(self): self.format = 'json' HTTPConnection.__init__(self, isbndb.HOSTNAME)
def __init__(self, path, *args, **kwargs): HTTPConnection.__init__(self, *args, **kwargs) self.path = path
def __init__(self, *args, **kwargs): HTTPConnection.__init__(self, *args, **kwargs)
def __init__(self, path): HTTPConnection.__init__(self, 'localhost') self.path = path
def __init__(self, host, port=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, connect_timeout=socket._GLOBAL_DEFAULT_TIMEOUT): HTTPConnection.__init__(self, host, port=port, strict=strict, timeout=timeout) self.connect_timeout = connect_timeout
def __init__(self, host, *a, **kw): HTTPConnection.__init__(self, 'localhost', *a, **kw) self.unix_path = unquote_plus(host.split(':', 1)[0])
def __init__(self, path, *args, **kwargs): HTTPConnection.__init__(self, *args, **kwargs) self.path = path
def __init__(self, host, port=None, strict=None): HTTPConnection.__init__(self, host, port, strict) self.request_length = 0