Skip to main content

Asynchronous Python API For My Gas

Project description

aiomygas

PyPI Python License CI

Asynchronous Python API for Мой Газ.

Installation

Use pip to install the library:

pip install aiomygas

Usage

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:

import asyncio

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

CLI

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

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

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiomygas-2.4.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiomygas-2.4.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file aiomygas-2.4.0.tar.gz.

File metadata

  • Download URL: aiomygas-2.4.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aiomygas-2.4.0.tar.gz
Algorithm Hash digest
SHA256 357969575a67576855506b2dcd3fce70c870d9b4f71ede23e03e0a75dd1e2cb3
MD5 1e106e34bd521f1052bfba59d72d78cf
BLAKE2b-256 6ac9aa88dd4c9211b8df7a814b5fcf48ff205f06411d1f57323068931d5aff44

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiomygas-2.4.0.tar.gz:

Publisher: publish.yml on lizardsystems/aiomygas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiomygas-2.4.0-py3-none-any.whl.

File metadata

  • Download URL: aiomygas-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aiomygas-2.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 928708ef995b1f018680439fcd85713776a14f4f27cfcf650121997e769d3e35
MD5 c5284d9d019292f57a21e578777a7c6a
BLAKE2b-256 75e93cd88da1ee1d47166330ecfd9adcecc15208add26812f8dd7bcc877563f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiomygas-2.4.0-py3-none-any.whl:

Publisher: publish.yml on lizardsystems/aiomygas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page