Skip to content

AsyncClient

async_client

Asynchronous yente / OpenSanctions client.

Mirrors :class:yente_client.client.Client method-for-method; every endpoint returns a coroutine. Refer to the sync client for per-method documentation — the only structural differences are language-level (await, async for).

AsyncClient

AsyncClient(*, api_key: str | None = None, base_url: str = DEFAULT_BASE_URL, app_name: str | None = None, user_agent: str | None = None, timeout: float | Timeout | None = None, verify: bool | str = True, proxy: str | None = None, headers: dict[str, str] | None = None, transport: AsyncBaseTransport | None = None)

Asynchronous client for the yente / OpenSanctions API.

Use as an async context manager for deterministic cleanup of the underlying httpx.AsyncClient. See :class:yente_client.Client for the sync counterpart.

user_agent property

user_agent: str

Return the User-Agent header this client sends on every request.

aclose async

aclose() -> None

Close the underlying httpx.AsyncClient.

adjacent async

adjacent(entity_id: str, *, prop: None = None, limit: int | None = None, offset: int = 0, sort: list[str] | None = None) -> AdjacentResponse
adjacent(entity_id: str, *, prop: str, limit: int | None = None, offset: int = 0, sort: list[str] | None = None) -> AdjacentPropertyResponse
adjacent(entity_id: str, *, prop: str | None = None, limit: int | None = None, offset: int = 0, sort: list[str] | None = None) -> AdjacentResponse | AdjacentPropertyResponse

Async equivalent of :meth:yente_client.client.Client.adjacent.

algorithms async

algorithms() -> AlgorithmsResponse

Async equivalent of :meth:yente_client.client.Client.algorithms.

datasets async

datasets() -> DatasetsResponse

Async equivalent of :meth:yente_client.client.Client.datasets.

fetch async

fetch(entity_id: str, *, nested: bool = True) -> Entity

Async equivalent of :meth:yente_client.client.Client.fetch.

healthz async

healthz() -> StatusResponse

Async equivalent of :meth:yente_client.client.Client.healthz.

match async

match(entity: EntityInput, *, filters: MatchFilters | None = None, threshold: float | None = None, cutoff: float | None = None, algorithm: str | None = None, weights: dict[str, float] | None = None, config: dict[str, Any] | None = None, limit: int | None = None, **filter_kwargs: Any) -> MatchResponse

Async equivalent of :meth:yente_client.client.Client.match.

match_iter async

match_iter(entities: Iterable[tuple[str, EntityInput]], *, workers: int = 4, filters: MatchFilters | None = None, threshold: float | None = None, cutoff: float | None = None, algorithm: str | None = None, weights: dict[str, float] | None = None, config: dict[str, Any] | None = None, limit: int | None = None, on_error: Literal['raise', 'collect'] = 'raise', **filter_kwargs: Any) -> AsyncIterator[tuple[str, MatchResponse | MatchError]]

Async equivalent of :meth:yente_client.client.Client.match_iter.

An async generator — iterate with async for, no await on the call itself.

programs async

programs() -> ProgramsResponse

Async equivalent of :meth:yente_client.client.Client.programs.

readyz async

readyz() -> StatusResponse

Async equivalent of :meth:yente_client.client.Client.readyz.

search async

search(q: str, *, filters: SearchFilters | None = None, limit: int | None = None, offset: int = 0, sort: list[str] | None = None, fuzzy: bool = False, simple: bool = False, facets: list[str] | None = None, **filter_kwargs: Any) -> SearchResponse

Async equivalent of :meth:yente_client.client.Client.search.

statements async

statements(*, dataset: str | None = None, entity_id: str | None = None, canonical_id: str | None = None, prop: str | None = None, value: str | None = None, schema: str | None = None, sort: list[str] | None = None, limit: int | None = None, offset: int = 0) -> StatementsResponse

Async equivalent of :meth:yente_client.client.Client.statements.

with_api_key

with_api_key(api_key: str) -> Self

Return a client that sends api_key over this client's connections.

Use this to serve many API keys, such as one per caller, from one connection pool. The returned client shares the httpx.AsyncClient and the ETag cache of this one. Close only the original client: closing either one closes the shared connections.