TT1410 / aiomono

The asynchronous library for monobank API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AIOMono (Alpha)

The aiomono is fully asynchronous library for Monobank API written in Python 3.8 with asyncio, aiohttp and pydantic.

Setup

  • You get token for your client from MonobankAPI.
  • Install the latest version of the aiomono: pip install aiomono

Examples

We have 3 different classes for use Monobank API:

  • MonoClient is simple base class for others, can only get currencies
  • PersonalMonoClient - this class for talk to personal Monobank API
  • CorporateMonoClient - this class for talk to corporate Monobank API (soon)

Simple get_currency request

import asyncio
from aiomono import MonoClient

mono_client = MonoClient()

async def main():
    async with mono_client as client:
        client_info = await client.get_currency()
        print(client_info)

asyncio.run(main())

client_info request

import asyncio
from aiomono import PersonalMonoClient

MONOBANK_API_TOKEN = 'your token'


async def main():
    try:
        mono_client = PersonalMonoClient(MONOBANK_API_TOKEN)
        client_info = await mono_client.client_info()
        print(f'User name {client_info.name} 😍')
    finally:
        await mono_client.close()

asyncio.run(main())

Resources:

About

The asynchronous library for monobank API


Languages

Language:Python 100.0%