tdk.internal.http¶
This module provides helper functions for making HTTP requests.
Module Contents¶
Functions¶
Create a |
|
Make |
Data¶
Default headers for HTTP requests. |
API¶
- tdk.internal.http.session_maker(**kwargs) aiohttp.ClientSession¶
Create a
aiohttp.ClientSessionwith some default headers.This is preferred over creating a base
aiohttp.ClientSessionbecause the TDK servers block requests that do not have headers.- Parameters:
kwargs –
Additional arguments to be passed to
aiohttp.ClientSession.Important
If a
headersargument is provided inkwargs, it will be modified to include the mandatory headers. Therefore it must be acollections.abc.MutableMapping.- Raises:
TypeError – if a
headersargument is provided and it is not acollections.abc.MutableMapping.
- tdk.internal.http.make_http_session_optional(func)¶
Make
aiohttp.ClientSessionoptional for functions that require it.Creates a decorator that provides a default
aiohttp.ClientSessioncreated bysession_makerto the wrapped function.