aioopenexchangerates package

Fetch rates from openexchangerates with aiohttp.

class aioopenexchangerates.Client(api_key: str, session: ClientSession | None = None)[source]

Bases: object

Represent the client for the Open Exchange Rates API.

async close() None[source]

Close the client.

async get_currencies(show_alternative: bool = False, show_inactive: bool = False) dict[str, str][source]

Get the supported currencies.

async get_latest(base: str = 'USD', symbols: list[str] | None = None) Latest[source]

Get the latest rates for the given base and symbols.

async request(endpoint: str, **kwargs: Any) ClientResponse[source]

Make a request.

class aioopenexchangerates.Latest(disclaimer: str, license: str, timestamp: int, base: str, rates: dict[str, float])[source]

Bases: BaseRatesResponse

Represent the model for endpoint latest.json.

classmethod from_dict(d, *, dialect=None)
to_dict()
exception aioopenexchangerates.OpenExchangeRatesAuthError[source]

Bases: OpenExchangeRatesClientError

Represent an authentication error.

exception aioopenexchangerates.OpenExchangeRatesClientError[source]

Bases: OpenExchangeRatesError

Represent a client error.

exception aioopenexchangerates.OpenExchangeRatesError[source]

Bases: Exception

Represent an error for the Open Exchange Rates API.

Subpackages

Submodules

aioopenexchangerates.client module

Provide a client for the Open Exchange Rates API.

class aioopenexchangerates.client.Client(api_key: str, session: ClientSession | None = None)[source]

Bases: object

Represent the client for the Open Exchange Rates API.

async close() None[source]

Close the client.

async get_currencies(show_alternative: bool = False, show_inactive: bool = False) dict[str, str][source]

Get the supported currencies.

async get_latest(base: str = 'USD', symbols: list[str] | None = None) Latest[source]

Get the latest rates for the given base and symbols.

async request(endpoint: str, **kwargs: Any) ClientResponse[source]

Make a request.

aioopenexchangerates.exceptions module

Provide exceptions for the Open Exchange Rates API.

exception aioopenexchangerates.exceptions.OpenExchangeRatesAuthError[source]

Bases: OpenExchangeRatesClientError

Represent an authentication error.

exception aioopenexchangerates.exceptions.OpenExchangeRatesClientError[source]

Bases: OpenExchangeRatesError

Represent a client error.

exception aioopenexchangerates.exceptions.OpenExchangeRatesError[source]

Bases: Exception

Represent an error for the Open Exchange Rates API.

exception aioopenexchangerates.exceptions.OpenExchangeRatesRateLimitError[source]

Bases: OpenExchangeRatesClientError

Represent a rate limit error.