aiomonobank 1.0.2

Creator: bradpython12

Last updated:

Add to Cart

Description:

aiomonobank 1.0.2

Asynchronous Python library for monobank API






Setup

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



Examples

We currently have 2 different classes for using the Monobank API:

MonoPublic is simple base class for others, can only get currencies
MonoPersonal - this class for talk to personal Monobank API



get_currency request
import json
import asyncio

from aiomonobank import MonoPublic, types


async def main():
async with MonoPublic() as mono_client:
currencies: list[types.Currency] = await mono_client.get_currency()

for currency in currencies:
print(currency)

if __name__ == '__main__':
asyncio.run(main())


get_client_info request
import asyncio

from aiomonobank import MonoPersonal

MONOBANK_API_TOKEN = 'your_token'


async def main():
mono_client = MonoPersonal(MONOBANK_API_TOKEN)
try:
client_info = await mono_client.get_client_info()

print(f"Client name: {client_info.name}")
print(client_info)
finally:
await mono_client.close()


if __name__ == '__main__':
asyncio.run(main())


get_statement request
import asyncio
from datetime import datetime, timedelta

from aiomonobank import MonoPersonal

MONOBANK_API_TOKEN = 'your_token'


async def main():
mono_client = MonoPersonal(MONOBANK_API_TOKEN)
try:
transactions = await mono_client.get_statement(
account_id='0',
from_datetime=datetime.utcnow() - timedelta(days=3),
to_datetime=datetime.utcnow() - timedelta(days=2)
)

for transaction in transactions:
print(transaction)
finally:
await mono_client.close()


if __name__ == '__main__':
asyncio.run(main())



Resources:

PyPI: aiomonobank
Documentation: (soon)

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.