🖥️ Clients

⭐ Asynchronous Client

class anmoku.clients.async_.AsyncAnmoku(debug: bool | None = False, jikan_url: str | None = None, session: ClientSession | None = None, rate_limits: Tuple[Tuple[int, int], Tuple[int, int]] | None = None)[source]

Bases: BaseClient

Asynchronous anmoku client. Uses aiohttp for http and slowstack for rate-limiting.

async close() None[source]
async get(resource: Type[NoArgsResourceGenericT]) NoArgsResourceGenericT[source]
async get(resource: Type[ResourceGenericT], id: StrOrIntT, **kwargs) ResourceGenericT

Get’s the exact resource typically by id.

jikan_url
async random(resource: Type[RandomResourceGenericT]) RandomResourceGenericT[source]

Fetches a random object of the specified resource.

async search(resource: Type[SearchResourceGenericT], query: str, sfw: bool = True) SearchResult[SearchResourceGenericT][source]

Searches for the resource and returns a list of the results.

✴️ Synchronous Client

class anmoku.clients.sync.Anmoku(debug: bool | None = False, jikan_url: str | None = None, session: Session | None = None, rate_limits: Tuple[Tuple[int, int], Tuple[int, int]] | None = None)[source]

Bases: BaseClient

The normal synchronous Anmoku client. Uses requests for http and slowstack for rate limiting.

close() None[source]
get(resource: Type[NoArgsResourceGenericT]) NoArgsResourceGenericT[source]
get(resource: Type[ResourceGenericT], id: StrOrIntT, **kwargs) ResourceGenericT

Get’s the exact resource typically by id.

jikan_url
random(resource: Type[RandomResourceGenericT]) RandomResourceGenericT[source]

Fetches a random object of the specified resource.

search(resource: Type[SearchResourceGenericT], query: str, sfw: bool = True) SearchResult[SearchResourceGenericT][source]

Searches for the resource and returns a list of the results.

⬛ Base Client

class anmoku.clients.base.BaseClient(debug: bool = False)[source]

Bases: ABC

Base class all clients will inherit from.

cache
abstract get(resource: Type[ResourceGenericT], id: StrOrIntT | None = None, **kwargs) ResourceGenericT[source]

Get’s the exact resource by id.

logger
abstract random(resource: Type[RandomResourceGenericT]) RandomResourceGenericT[source]

Fetches a random object of the specified resource.

abstract search(resource: Type[SearchResourceGenericT], query: str, sfw: bool = True) SearchResult[SearchResourceGenericT][source]

Searches for the resource and returns a list of the results.