hikari.internal.net#
General bits and pieces that are reused between components.
Module Contents#
- hikari.internal.net.create_client_session(connector, connector_owner, http_settings, raise_for_status, trust_env)[source]#
Generate a client session using the given settings.
Warning
You must invoke this from within a running event loop.
Note
If you pass an explicit connector, then the connection that is created will not own the connector. You will be expected to manually close it __after__ the returned client session is closed to prevent leaking resources.
- Parameters:
- connector
aiohttp.BaseConnector
The connector to use.
- connector_ownerbool
If
True
, then the client session will close the connector on shutdown. Otherwise, you must do it manually.- http_settings
hikari.impl.config.HTTPSettings
HTTP settings to use.
- raise_for_statusbool
True
to default to throwing exceptions if a request fails, orFalse
to default to not.- trust_envbool
True
to trust anything in environment variables and thenetrc
file,False
to ignore it.
- connector
- Returns:
aiohttp.ClientSession
The client session to use.