Asynchronous Python library for monobank API
Project description
AIOMonobank
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
.. image:: https://img.shields.io/pypi/l/aiomonobank.svg?style=flat-square :target: https://opensource.org/licenses/MIT :alt: MIT License
.. image:: https://img.shields.io/pypi/status/aiomonobank.svg?style=flat-square :target: https://pypi.python.org/pypi/aiomonobank :alt: PyPi status
.. image:: https://img.shields.io/pypi/v/aiomonobank.svg?style=flat-square :target: https://pypi.python.org/pypi/aiomonobank :alt: PyPi Package Version
.. image:: https://img.shields.io/pypi/dm/aiomonobank.svg?style=flat-square :target: https://pypi.python.org/pypi/aiomonobank :alt: Downloads
.. image:: https://img.shields.io/pypi/pyversions/aiomonobank.svg?style=flat-square :target: https://pypi.python.org/pypi/aiomonobank :alt: Supported python versions
Examples
We currently have 2 different classes for using the Monobank API.:
MonoPublic
is simple base class for others, can only get currenciesMonoPersonal
- this class for talk to personal Monobank API
get_currency request
import json
import asyncio
from aiomonobank import MonoPublic
async def main():
async with MonoPublic() as mono_client:
currency = await mono_client.get_currency()
print(json.dumps(currency, ensure_ascii=False, indent=4))
if __name__ == '__main__':
asyncio.run(main())
get_client_info request
import json
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(json.dumps(client_info, ensure_ascii=False, indent=4))
finally:
await mono_client.close()
if __name__ == '__main__':
asyncio.run(main())
get_statement request
import json
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)
)
print(json.dumps(transactions, ensure_ascii=False, indent=4))
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
Hashes for aiomonobank-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e56d10340b7f7890a4f0a1682df63a2017da2006bc538690f909bbf12e53909f |
|
MD5 | 8efba98f89c3b4f9a763482d3fd5ccd5 |
|
BLAKE2b-256 | d6b60d6e393b2b72ba82ef7a2b8fab452f6a7ee7612217efe0a095792747adf6 |