zapi.infrastructure.http package

Submodules

zapi.infrastructure.http.auth module

zapi.infrastructure.http.auth.api_token_headers(email: str, api_token: str) dict[str, str][source]
zapi.infrastructure.http.auth.oauth_headers(token: str) dict[str, str][source]

zapi.infrastructure.http.client module

class zapi.infrastructure.http.client.HttpClient(base_url: str, headers: dict[str, str], timeout: float = 30.0)[source]

Bases: object

delete(path: str) None[source]
get(path: str) dict[source]
post(path: str, json: dict) dict[source]
put(path: str, json: dict) dict[source]

zapi.infrastructure.http.pagination module

Zendesk style cursor link extractor. Accepts absolute or relative next links and returns a relative path.

zapi.infrastructure.http.pagination.yield_items(get_json, first_path: str, base_url: str, items_key: str) Iterator[dict][source]

Convenience iterator that yields individual items from a list key.

zapi.infrastructure.http.pagination.yield_pages(get_json, first_path: str, base_url: str) Iterator[dict][source]

Generic pager. get_json is a callable like http.get that returns a dict. Yields the full page payload dict so callers can choose the list key.

Module contents