# monobank-api-client
This module provides quick integration of the Monobank API for developing applications based on synchronous and asynchronous frameworks.
## Name
monobank_api_client
## Installation
This framework is published at the PyPI, install it with pip:
1.This package makes it possible to use module methods in synchronous frameworks:
pip install monobank-api-client[http]
2.This package makes it possible to use module methods in asynchronous frameworks:
pip install monobank-api-client[aio]
3.This package makes it possible to use ready-made views with a synchronous script based on the Django Rest framework:
pip install monobank-api-client[drf]
To get started, add the following packages to INSTALLED_APPS:
INSTALLED_APPS = [
...
'rest_framework',
'drf_mono',
]
Include drf_mono urls to your urls.py:
urlpatterns = [
...
path('mono/', include('drf_mono.urls', namespace='drf_mono')),
]
4.This package makes it possible to use ready-made routers with an asynchronous script based on the FastAPI framework:
pip install monobank-api-client[fastapi]
5.To install all packages at once:
pip install monobank-api-client[all]
## Usage
1. Request your token at https://api.monobank.ua/
2. For a synchronous request use that token to initialize client:
from sync_mono.manager import SyncMonoManager
token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
mng = SyncMonoManager(token)
3. For an asynchronous request, use this token to initialize the client:
from async_mono.manager import AsyncMonoManager
token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
mng = AsyncMonoManager(token)
### Methods
Get currencies
```python
>>> mng.get_currencies()
{
"code": 200,
"detail":
[
{
"currencyCodeA": 840,
"currencyCodeB": 980,
"date": 1702591273,
"rateBuy": 36.95,
"rateSell": 37.4406
},
{
"currencyCodeA": 978,
"currencyCodeB": 980,
"date": 1702623973,
"rateBuy": 40.35,
"rateSell": 41.1404
},
{
"currencyCodeA": 978,
"currencyCodeB": 840,
"date": 1702623973,
"rateBuy": 1.086,
"rateSell": 1.1025
},
...
]
}
```
Get currency
```python
>>> mng.get_currency('USDUAH')
{
"code": 200,
"detail": {
"USDUAH": {
"Buy": 37.5,
"Sale": 37.8702
}
}
}
```
Get client info
```python
>>> mng.get_client_info()
{
"code": 200,
"detail":
{
"clientId": "xxxxxxxxxx",
"name": "Last name First name",
"webHookUrl": "",
"permissions": "psfj",
"accounts": [
{
"id": "xxxxxxxxxxxxxxxxxxx",
"sendId": "xxxxxxxxxx",
"currencyCode": 980,
"cashbackType": "UAH",
"balance": xxxxx,
"creditLimit": 0,
"maskedPan": [
"xxxxxx******xxxx"
],
"type": "black",
"iban": "UAxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
]
}
}
```
Get balance
```python
>>> mng.get_balance()
{
"code": 200,
"detail":
{
"balance": x.xx
}
}
```
Get statement
```python
>>> period = 31
>>> mng.get_statement(period)
{
"code": 200,
"detail":
[
{
"id": "xxxxxxxxxxxxxxxxxx",
"time": xxxxxxxxxx,
"description": "xxxx xxxxx",
"mcc": xxxx,
"originalMcc": xxxx,
"amount": -xxxxx,
"operationAmount": -xxxxx,
"currencyCode": xxx,
"commissionRate": x,
"cashbackAmount": xxx,
"balance": xxxx,
"hold": false,
"receiptId": "xxxx-xxxx-xxxx-xxxx"
},
...
]
}
```
Create a Webhook
```python
>>> mng.create_webhook('https://myserver.com/hookpath')
```
Raw data
{
"_id": null,
"home_page": "https://gitlab.onix.ua/onix-systems/python-internal-mono",
"name": "monobank-api-client",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "files speedfiles",
"author": "ihor.sotnyk",
"author_email": "ihor.sotnyk@onix-systems.com",
"download_url": "https://files.pythonhosted.org/packages/f7/8f/e59bb537866785a1f0f63b25b506da3559995cbe3b46531196bc45339f1a/monobank_api_client-1.2.3.tar.gz",
"platform": null,
"description": "# monobank-api-client\r\nThis module provides quick integration of the Monobank API for developing applications based on synchronous and asynchronous frameworks.\r\n\r\n## Name\r\nmonobank_api_client\r\n\r\n## Installation\r\nThis framework is published at the PyPI, install it with pip:\r\n\r\n 1.This package makes it possible to use module methods in synchronous frameworks:\r\n\r\n pip install monobank-api-client[http]\r\n\r\n 2.This package makes it possible to use module methods in asynchronous frameworks:\r\n\r\n pip install monobank-api-client[aio]\r\n\r\n 3.This package makes it possible to use ready-made views with a synchronous script based on the Django Rest framework:\r\n\r\n pip install monobank-api-client[drf]\r\n\r\n To get started, add the following packages to INSTALLED_APPS:\r\n\r\n INSTALLED_APPS = [\r\n ...\r\n 'rest_framework',\r\n 'drf_mono',\r\n ]\r\n\r\n Include drf_mono urls to your urls.py:\r\n\r\n urlpatterns = [\r\n ...\r\n path('mono/', include('drf_mono.urls', namespace='drf_mono')),\r\n ]\r\n \r\n 4.This package makes it possible to use ready-made routers with an asynchronous script based on the FastAPI framework:\r\n\r\n pip install monobank-api-client[fastapi]\r\n\r\n 5.To install all packages at once:\r\n\r\n pip install monobank-api-client[all]\r\n\r\n## Usage\r\n\r\n1. Request your token at https://api.monobank.ua/\r\n2. For a synchronous request use that token to initialize client:\r\n\r\n from sync_mono.manager import SyncMonoManager\r\n\r\n token = \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\r\n\r\n mng = SyncMonoManager(token)\r\n\r\n3. For an asynchronous request, use this token to initialize the client:\r\n\r\n from async_mono.manager import AsyncMonoManager\r\n\r\n token = \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\r\n\r\n mng = AsyncMonoManager(token)\r\n\r\n### Methods\r\n\r\nGet currencies\r\n```python\r\n>>> mng.get_currencies()\r\n{\r\n \"code\": 200,\r\n \"detail\":\r\n [\r\n {\r\n \"currencyCodeA\": 840,\r\n \"currencyCodeB\": 980,\r\n \"date\": 1702591273,\r\n \"rateBuy\": 36.95,\r\n \"rateSell\": 37.4406\r\n },\r\n {\r\n \"currencyCodeA\": 978,\r\n \"currencyCodeB\": 980,\r\n \"date\": 1702623973,\r\n \"rateBuy\": 40.35,\r\n \"rateSell\": 41.1404\r\n },\r\n {\r\n \"currencyCodeA\": 978,\r\n \"currencyCodeB\": 840,\r\n \"date\": 1702623973,\r\n \"rateBuy\": 1.086,\r\n \"rateSell\": 1.1025\r\n },\r\n ...\r\n ]\r\n}\r\n```\r\n\r\nGet currency\r\n```python\r\n>>> mng.get_currency('USDUAH')\r\n{\r\n \"code\": 200,\r\n \"detail\": {\r\n \"USDUAH\": {\r\n \"Buy\": 37.5,\r\n \"Sale\": 37.8702\r\n }\r\n }\r\n}\r\n```\r\n\r\nGet client info\r\n```python\r\n>>> mng.get_client_info()\r\n{\r\n \"code\": 200,\r\n \"detail\":\r\n {\r\n \"clientId\": \"xxxxxxxxxx\",\r\n \"name\": \"Last name First name\",\r\n \"webHookUrl\": \"\",\r\n \"permissions\": \"psfj\",\r\n \"accounts\": [\r\n {\r\n \"id\": \"xxxxxxxxxxxxxxxxxxx\",\r\n \"sendId\": \"xxxxxxxxxx\",\r\n \"currencyCode\": 980,\r\n \"cashbackType\": \"UAH\",\r\n \"balance\": xxxxx,\r\n \"creditLimit\": 0,\r\n \"maskedPan\": [\r\n \"xxxxxx******xxxx\"\r\n ],\r\n \"type\": \"black\",\r\n \"iban\": \"UAxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\r\n }\r\n ]\r\n }\r\n}\r\n```\r\n\r\nGet balance\r\n```python\r\n>>> mng.get_balance()\r\n{\r\n \"code\": 200,\r\n \"detail\":\r\n {\r\n \"balance\": x.xx\r\n }\r\n}\r\n```\r\n\r\nGet statement\r\n```python\r\n>>> period = 31\r\n>>> mng.get_statement(period)\r\n{\r\n \"code\": 200,\r\n \"detail\":\r\n [\r\n {\r\n \"id\": \"xxxxxxxxxxxxxxxxxx\",\r\n \"time\": xxxxxxxxxx,\r\n \"description\": \"xxxx xxxxx\",\r\n \"mcc\": xxxx,\r\n \"originalMcc\": xxxx,\r\n \"amount\": -xxxxx,\r\n \"operationAmount\": -xxxxx,\r\n \"currencyCode\": xxx,\r\n \"commissionRate\": x,\r\n \"cashbackAmount\": xxx,\r\n \"balance\": xxxx,\r\n \"hold\": false,\r\n \"receiptId\": \"xxxx-xxxx-xxxx-xxxx\"\r\n },\r\n ...\r\n ]\r\n}\r\n```\r\n\r\nCreate a Webhook\r\n```python\r\n>>> mng.create_webhook('https://myserver.com/hookpath')\r\n```\r\n",
"bugtrack_url": null,
"license": "",
"summary": "This module is designed for quick interaction with the monobank API.",
"version": "1.2.3",
"project_urls": {
"Homepage": "https://gitlab.onix.ua/onix-systems/python-internal-mono"
},
"split_keywords": [
"files",
"speedfiles"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f78fe59bb537866785a1f0f63b25b506da3559995cbe3b46531196bc45339f1a",
"md5": "811583815fd8a7ca6dd4fb05f4d971c2",
"sha256": "344e5fc2587a2ab7d29ce802800804b4ef9d36264f632d078b81f0c69bb2b38e"
},
"downloads": -1,
"filename": "monobank_api_client-1.2.3.tar.gz",
"has_sig": false,
"md5_digest": "811583815fd8a7ca6dd4fb05f4d971c2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 12804,
"upload_time": "2024-01-28T15:18:41",
"upload_time_iso_8601": "2024-01-28T15:18:41.116365Z",
"url": "https://files.pythonhosted.org/packages/f7/8f/e59bb537866785a1f0f63b25b506da3559995cbe3b46531196bc45339f1a/monobank_api_client-1.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-28 15:18:41",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "monobank-api-client"
}