Skip to content

client

This module has the client to connect to BlueArchive API.

Client

An asynchronous client used to interact with the BlueArchive API.

Source code in barch\client.py
class Client:
    """An asynchronous client used to interact with the BlueArchive API."""

    __slots__ = ("_http", "_serializer", "_character", "_raid")

    def __init__(self) -> None:
        self._http = services.HttpService()
        self._serializer = serializer.Serializer()
        self._character = services.CharacterService(self._http, self._serializer)
        self._raid = services.RaidService(self._http, self._serializer)

    @property
    def character(self) -> services.CharacterService:
        """The [`CharacterService`][barch.CharacterService] used to make character related requests."""

        return self._character

    @property
    def raid(self) -> services.RaidService:
        """The [`RaidService`][barch.RaidService] used to make raid related requests."""

        return self._raid

    async def close(self) -> None:
        """Close the existing client session.

        !!! warning

            You will receive an error in your console if this is not called before the program terminates."""

        await self._http.close()

character property

character: services.CharacterService

The CharacterService used to make character related requests.

raid property

raid: services.RaidService

The RaidService used to make raid related requests.

close async

close() -> None

Close the existing client session.

Warning

You will receive an error in your console if this is not called before the program terminates.

Source code in barch\client.py
async def close(self) -> None:
    """Close the existing client session.

    !!! warning

        You will receive an error in your console if this is not called before the program terminates."""

    await self._http.close()