network.connection
Module¶
Network connections.
-
class
wpull.network.connection.
BaseConnection
(address: tuple, hostname: typing.Union=None, timeout: typing.Union=None, connect_timeout: typing.Union=None, bind_host: typing.Union=None, sock: typing.Union=None)[source]¶ Bases:
object
Base network stream.
Parameters: - address – 2-item tuple containing the IP address and port or 4-item for IPv6.
- hostname – Hostname of the address (for SSL).
- timeout – Time in seconds before a read/write operation times out.
- connect_timeout – Time in seconds before a connect operation times out.
- bind_host – Host name for binding the socket interface.
- sock – Use given socket. The socket must already by connected.
-
reader
¶ Stream Reader instance.
-
writer
¶ Stream Writer instance.
-
address
¶ 2-item tuple containing the IP address.
-
host
¶ Host name.
-
port
¶ Port number.
-
address
-
host
-
hostname
¶
-
port
-
class
wpull.network.connection.
CloseTimer
(timeout, connection)[source]¶ Bases:
object
Periodic timer to close connections if stalled.
-
class
wpull.network.connection.
Connection
(*args, bandwidth_limiter=None, **kwargs)[source]¶ Bases:
wpull.network.connection.BaseConnection
Network stream.
Parameters: (class (bandwidth_limiter) – .bandwidth.BandwidthLimiter): Bandwidth limiter for connection speed limiting. -
key
¶ Value used by the ConnectionPool for its host pool map. Internal use only.
-
wrapped_connection
¶ A wrapped connection for ConnectionPool. Internal use only.
-
is_ssl
¶ bool
Whether connection is SSL.
-
proxied
¶ bool
Whether the connection is to a HTTP proxy.
-
tunneled
¶ bool
Whether the connection has been tunneled with the
CONNECT
request.
-
is_ssl
-
proxied
-
start_tls
(ssl_context: typing.Union=True) → 'SSLConnection'[source]¶ Start client TLS on this connection and return SSLConnection.
Coroutine
-
tunneled
-
-
class
wpull.network.connection.
ConnectionState
[source]¶ Bases:
enum.Enum
State of a connection
-
ready
¶ Connection is ready to be used
-
created
¶ connect has been called successfully
-
dead
¶ Connection is closed
-