Simplified Async Socket¶
- class urllib3.contrib.ssa.AsyncSocket(family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=-1, fileno=None)¶
Bases:
objectThis class is brought to add a level of abstraction to an asyncio transport (reader, or writer) We don’t want to have two distinct code (async/sync) but rather a unified and easily verifiable code base.
‘ssa’ stands for Simplified - Socket - Asynchronous.
- close()¶
- Return type:
None
- async connect(addr)¶
- getsockopt(_AsyncSocket__level, _AsyncSocket__optname)¶
- async read()¶
Just an alias for sendall(), it is needed due to our custom AsyncSocks override.
- Return type:
- async read_exact(size=-1)¶
Just an alias for sendall(), it is needed due to our custom AsyncSocks override.
- async send(data)¶
- Parameters:
data (bytes | bytearray | memoryview)
- Return type:
None
- async sendall(data)¶
- Parameters:
data (bytes | bytearray | memoryview)
- Return type:
None
- setsockopt(_AsyncSocket__level, _AsyncSocket__optname, _AsyncSocket__value)¶
- settimeout(_AsyncSocket__value=None)¶
- Parameters:
_AsyncSocket__value (float | None)
- Return type:
None
- async wait_for_readiness()¶
- Return type:
None
- async wrap_socket(ctx, *, server_hostname=None, ssl_handshake_timeout=None)¶
- Parameters:
ctx (ssl.SSLContext)
server_hostname (str | None)
ssl_handshake_timeout (float | None)
- Return type:
- async write_all(data)¶
Just an alias for sendall(), it is needed due to our custom AsyncSocks override.
- Parameters:
data (bytes | bytearray | memoryview)
- Return type:
None
- class urllib3.contrib.ssa.SSLAsyncSocket(family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=-1, fileno=None)¶
Bases:
AsyncSocket- getpeercert(binary_form: Literal[False] = False) _TYPE_PEER_CERT_RET_DICT | None¶
- getpeercert(binary_form: Literal[True]) bytes | None
- property sslobj: ssl.SSLSocket | ssl.SSLObject¶
- async wrap_socket(ctx, *, server_hostname=None, ssl_handshake_timeout=None)¶
- Parameters:
ctx (ssl.SSLContext)
server_hostname (str | None)
ssl_handshake_timeout (float | None)
- Return type: