alexapy.aiohttp.connector
¶
Classes¶
BaseConnector
: Base connector class.TCPConnector
: TCP connector.UnixConnector
: Unix socket connector.NamedPipeConnector
: Named pipe connector.
- class alexapy.aiohttp.connector.BaseConnector(*, keepalive_timeout: typing.Union[object, None, float] = <object object>, force_close: bool = False, limit: int = 100, limit_per_host: int = 0, enable_cleanup_closed: bool = False, loop: typing.Optional[asyncio.events.AbstractEventLoop] = None)¶
Base connector class.
keepalive_timeout - (optional) Keep-alive timeout. force_close - Set to True to force close and do reconnect
after each request (and between redirects).
limit - The total number of simultaneous connections. limit_per_host - Number of simultaneous connections to one host. enable_cleanup_closed - Enables clean-up closed ssl transports.
Disabled by default.
loop - Optional event loop.
Inheritance
- close() Awaitable[None] ¶
Close all opened transports.
- property closed: bool¶
Is connector closed.
A readonly property.
- async connect(req: ClientRequest, traces: List[Trace], timeout: ClientTimeout) alexapy.aiohttp.connector.Connection ¶
Get from pool or create new connection.
- property force_close: bool¶
Ultimately close connection on releasing if True.
- property limit: int¶
The total number for simultaneous connections.
If limit is 0 the connector has no limit. The default limit size is 100.
- property limit_per_host: int¶
The limit for simultaneous connections to the same endpoint.
Endpoints are the same if they are have equal (host, port, is_ssl) triple.
- class alexapy.aiohttp.connector.TCPConnector(*, verify_ssl: bool = True, fingerprint: typing.Optional[bytes] = None, use_dns_cache: bool = True, ttl_dns_cache: typing.Optional[int] = 10, family: int = 0, ssl_context: typing.Optional[ssl.SSLContext] = None, ssl: typing.Union[None, bool, alexapy.aiohttp.client_reqrep.Fingerprint, ssl.SSLContext] = None, local_addr: typing.Optional[typing.Tuple[str, int]] = None, resolver: typing.Optional[alexapy.aiohttp.abc.AbstractResolver] = None, keepalive_timeout: typing.Union[None, float, object] = <object object>, force_close: bool = False, limit: int = 100, limit_per_host: int = 0, enable_cleanup_closed: bool = False, loop: typing.Optional[asyncio.events.AbstractEventLoop] = None)¶
TCP connector.
verify_ssl - Set to True to check ssl certifications. fingerprint - Pass the binary sha256
digest of the expected certificate in DER format to verify that the certificate the server presents matches. See also https://en.wikipedia.org/wiki/Transport_Layer_Security#Certificate_pinning
- resolver - Enable DNS lookups and use this
resolver
use_dns_cache - Use memory cache for DNS lookups. ttl_dns_cache - Max seconds having cached a DNS entry, None forever. family - socket address family local_addr - local tuple of (host, port) to bind socket to
keepalive_timeout - (optional) Keep-alive timeout. force_close - Set to True to force close and do reconnect
after each request (and between redirects).
limit - The total number of simultaneous connections. limit_per_host - Number of simultaneous connections to one host. enable_cleanup_closed - Enables clean-up closed ssl transports.
Disabled by default.
loop - Optional event loop.
Inheritance
- clear_dns_cache(host: Optional[str] = None, port: Optional[int] = None) None ¶
Remove specified host/port or clear all dns local cache.
- close() Awaitable[None] ¶
Close all ongoing DNS calls.
- property family: int¶
Socket family like AF_INET.
- property use_dns_cache: bool¶
True if local DNS caching is enabled.
- class alexapy.aiohttp.connector.UnixConnector(path: str, force_close: bool = False, keepalive_timeout: typing.Optional[typing.Union[object, float]] = <object object>, limit: int = 100, limit_per_host: int = 0, loop: typing.Optional[asyncio.events.AbstractEventLoop] = None)¶
Unix socket connector.
path - Unix socket path. keepalive_timeout - (optional) Keep-alive timeout. force_close - Set to True to force close and do reconnect
after each request (and between redirects).
limit - The total number of simultaneous connections. limit_per_host - Number of simultaneous connections to one host. loop - Optional event loop.
Inheritance
- property path: str¶
Path to unix socket.
- class alexapy.aiohttp.connector.NamedPipeConnector(path: str, force_close: bool = False, keepalive_timeout: typing.Optional[typing.Union[object, float]] = <object object>, limit: int = 100, limit_per_host: int = 0, loop: typing.Optional[asyncio.events.AbstractEventLoop] = None)¶
Named pipe connector.
Only supported by the proactor event loop. See also: https://docs.python.org/3.7/library/asyncio-eventloop.html
path - Windows named pipe path. keepalive_timeout - (optional) Keep-alive timeout. force_close - Set to True to force close and do reconnect
after each request (and between redirects).
limit - The total number of simultaneous connections. limit_per_host - Number of simultaneous connections to one host. loop - Optional event loop.
Inheritance
- property path: str¶
Path to the named pipe.