Metadata-Version: 2.4
Name: aiomygas
Version: 2.4.0
Summary: Asynchronous Python API For My Gas
Author: LizardSystems
License: MIT License
Project-URL: Home, https://github.com/lizardsystems/aiomygas
Project-URL: Repository, https://github.com/lizardsystems/aiomygas
Project-URL: Documentation, https://github.com/lizardsystems/aiomygas
Project-URL: Bug Tracker, https://github.com/lizardsystems/aiomygas/issues
Project-URL: Changelog, https://github.com/lizardsystems/aiomygas/blob/main/CHANGELOG.md
Keywords: energy,gas
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Typing :: Typed
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-asyncio; extra == "test"
Dynamic: license-file

# aiomygas

[![PyPI](https://img.shields.io/pypi/v/aiomygas)](https://pypi.org/project/aiomygas/)
[![Python](https://img.shields.io/pypi/pyversions/aiomygas)](https://pypi.org/project/aiomygas/)
[![License](https://img.shields.io/pypi/l/aiomygas)](https://github.com/lizardsystems/aiomygas/blob/main/LICENSE)
[![CI](https://github.com/lizardsystems/aiomygas/actions/workflows/ci.yml/badge.svg)](https://github.com/lizardsystems/aiomygas/actions/workflows/ci.yml)

Asynchronous Python API for [Мой Газ](https://мойгаз.смородина.онлайн/).

## Installation

Use pip to install the library:

```commandline
pip install aiomygas
```

## Usage

```python
import asyncio
from pprint import pprint

import aiohttp

from aiomygas import SimpleMyGasAuth, MyGasApi


async def main(email: str, password: str) -> None:
    """Create the aiohttp session and run the example."""
    async with aiohttp.ClientSession() as session:
        auth = SimpleMyGasAuth(email, password, session)
        api = MyGasApi(auth)

        data = await api.async_get_accounts()

        pprint(data)


if __name__ == "__main__":
    _email = str(input("Email: "))
    _password = str(input("Password: "))
    asyncio.run(main(_email, _password))
```

## Exceptions

All exceptions inherit from `MyGasApiError`:

- `MyGasApiError` — base class for all API errors
- `MyGasApiParseError` — response parsing errors
- `MyGasAuthError` — authentication errors

## Timeouts

aiomygas does not specify any timeouts for any requests. You will need to specify them in your own code. We recommend `asyncio.timeout`:

```python
import asyncio

async with asyncio.timeout(10):
    data = await api.async_get_accounts()
```

## CLI

```commandline
aiomygas-cli user@example.com password --accounts
aiomygas-cli user@example.com password --client
aiomygas-cli user@example.com password --charges
aiomygas-cli user@example.com password --payments
aiomygas-cli user@example.com password --info
```

## Development

```commandline
python -m venv .venv
.venv/bin/pip install -r requirements_test.txt -e .
pytest tests/ -v
```

## Links

- [PyPI](https://pypi.org/project/aiomygas/)
- [GitHub](https://github.com/lizardsystems/aiomygas)
- [Changelog](https://github.com/lizardsystems/aiomygas/blob/main/CHANGELOG.md)
- [Bug Tracker](https://github.com/lizardsystems/aiomygas/issues)
