# aioopenexchangerates

<p align="center">
  <a href="https://github.com/MartinHjelmare/aioopenexchangerates/actions?query=workflow%3ACI">
    <img src="https://img.shields.io/github/actions/workflow/status/MartinHjelmare/aioopenexchangerates/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
  </a>
  <a href="https://aioopenexchangerates.readthedocs.io">
    <img src="https://img.shields.io/readthedocs/aioopenexchangerates.svg?logo=read-the-docs&logoColor=fff&style=flat-square" alt="Documentation Status">
  </a>
  <a href="https://codecov.io/gh/MartinHjelmare/aioopenexchangerates">
    <img src="https://img.shields.io/codecov/c/github/MartinHjelmare/aioopenexchangerates.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
  </a>
</p>
<p align="center">
  <a href="https://python-poetry.org/">
    <img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64, " alt="Poetry">
  </a>
  <a href="https://github.com/ambv/black">
    <img src="https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square" alt="black">
  </a>
  <a href="https://github.com/pre-commit/pre-commit">
    <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
  </a>
</p>
<p align="center">
  <a href="https://pypi.org/project/aioopenexchangerates/">
    <img src="https://img.shields.io/pypi/v/aioopenexchangerates.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
  </a>
  <img src="https://img.shields.io/pypi/pyversions/aioopenexchangerates.svg?style=flat-square&logo=python&amp;logoColor=fff" alt="Supported Python versions">
  <img src="https://img.shields.io/pypi/l/aioopenexchangerates.svg?style=flat-square" alt="License">
</p>

Fetch rates from openexchangerates with aiohttp.

## Installation

Install this via pip (or your favourite package manager):

`pip install aioopenexchangerates`

## Usage

```py
import asyncio

from aioopenexchangerates import Client, OpenExchangeRatesError


async def main() -> None:
    """Run main."""
    async with Client("your_api_key") as client:
        try:
            result = await client.get_latest()
        except OpenExchangeRatesError as err:
            print(err)
        else:
            print(result)


if __name__ == "__main__":
    asyncio.run(main())
```

## Credits

This package was created with
[Cookiecutter](https://github.com/audreyr/cookiecutter) and the
[browniebroke/cookiecutter-pypackage](https://github.com/browniebroke/cookiecutter-pypackage)
project template.
