Asynchronous Python library for monobank API
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiomonobank-1.0.2.tar.gz.
File metadata
- Download URL: aiomonobank-1.0.2.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f43893077ad7b744391e543ef40b44ed0243a3b4dc9d871e1c2acdb1f3eb85a
|
|
| MD5 |
5c510fe23d6f34b63529915a46b4e8e0
|
|
| BLAKE2b-256 |
899f559fcbf1cc7dbf5ffd7cda7375bb964f4719a41958dff506141a8c090cc8
|
File details
Details for the file aiomonobank-1.0.2-py3-none-any.whl.
File metadata
- Download URL: aiomonobank-1.0.2-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24a80d9a66a5dfb39fee7dd5e4e72345e5ce1a9661043f9f2f96dd136580c275
|
|
| MD5 |
1e7c48112ed3e2bae7e46ed901061840
|
|
| BLAKE2b-256 |
4d7a85b262faa1f87dac17cb01b8aca860f08ad4b8596f0ec20fd01b11c0198c
|