connection

Module Contents

Classes

DummyConnection() “Used to detect a failed ConnectionCls import.”
BaseSSLError()
ConnectionError()
HTTPConnection(self,*args,**kw) Based on httplib.HTTPConnection but provides an extra constructor
HTTPSConnection(self,host,port=None,key_file=None,cert_file=None,strict=None,timeout=None,**kw)
VerifiedHTTPSConnection() Based on httplib.HTTPSConnection but wraps the socket with
class DummyConnection

“Used to detect a failed ConnectionCls import.”

class BaseSSLError
class ConnectionError
class HTTPConnection(*args, **kw)

Based on httplib.HTTPConnection but provides an extra constructor backwards-compatibility layer between older and newer Pythons.

Additional keyword parameters are used to configure attributes of the connection. Accepted parameters include:

  • strict: See the documentation on urllib3.connectionpool.HTTPConnectionPool

  • source_address: Set the source address for the current connection.

    Note

    This is ignored for Python 2.6. It is only applied for 2.7 and 3.x

  • socket_options: Set specific options on the underlying socket. If not specified, then defaults are loaded from HTTPConnection.default_socket_options which includes disabling Nagle’s algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy.

    For example, if you wish to enable TCP Keep Alive in addition to the defaults, you might pass:

    HTTPConnection.default_socket_options + [
        (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
    ]
    

    Or you may want to disable the defaults by passing an empty list (e.g., []).

__init__(*args, **kw)
_new_conn()

Establish a socket connection and set nodelay settings on it.

Returns:New socket connection.
_prepare_conn(conn)
connect()
class HTTPSConnection(host, port=None, key_file=None, cert_file=None, strict=None, timeout=None, **kw)
__init__(host, port=None, key_file=None, cert_file=None, strict=None, timeout=None, **kw)
connect()
class VerifiedHTTPSConnection

Based on httplib.HTTPSConnection but wraps the socket with SSL certification.

set_cert(key_file=None, cert_file=None, cert_reqs=None, ca_certs=None, assert_hostname=None, assert_fingerprint=None)
connect()