Advanced

Custom HTTP client adaptor

If for some reason you want to use neither aiohttp nor httpx, you can adapt your own HTTP client for usage with aiodynamo. To do so, create a class that conforms to the aiodynamo.http.base.HTTP interface. Errors should be wrapped in a aiodynamo.http.base.RequestFailed.

class aiodynamo.http.base.HTTP
get(*, url: yarl.URL, headers: Optional[Dict[str, str]] = None, timeout: Union[float, int]) → bytes

Make a GET request and return the response as bytes.

Raise a RequestFailed exception if the request was not successful.

post(*, url: yarl.URL, body: bytes, headers: Optional[Dict[str, str]] = None) → Dict[str, Any]

Make a POST request and return the parsed JSON object.

Raise a RequestFailed exception if the request was not successful.

exception aiodynamo.http.base.RequestFailed

Custom Credentials loader

If you need a special way to load credentials, you can do so by creating a class which conforms to thee aiodynamo.credentials.Credentials interface.

class aiodynamo.credentials.Credentials
get_key(http: aiodynamo.http.base.HTTP) → Optional[aiodynamo.credentials.Key]

Return a Key if one could be found.

invalidate() → bool

Invalidate the credentials if possible and return whether credentials got invalidated or not.

is_disabled() → bool

Indicate if this credentials provider is disabled. Used by ChainCredentials to ignore providers that won’t ever find a key.

If the status could change over the lifetime of a program, return True.