From 34247c3fd9d202376bdfc74fe5d521035a646f8b Mon Sep 17 00:00:00 2001 From: The DT Date: Sat, 1 Jun 2024 13:41:04 +0700 Subject: [PATCH] add docs --- .readthedocs.yaml | 26 ++++++ docs/api_document/async_api.md | 162 +++++++++++++++++++++++++++++++++ docs/api_document/sync_api.md | 162 +++++++++++++++++++++++++++++++++ docs/css/main.css | 0 docs/gen_doc.py | 92 +++++++++++++++++++ docs/index.md | 16 ++++ docs/req.in | 4 + mbbank/__init__.py | 4 +- mbbank/main.py | 158 +++++++++++++++++++++++++++++--- mbbank/mbasync.py | 159 ++++++++++++++++++++++++++++---- mkdocs.yml | 22 +++++ 11 files changed, 771 insertions(+), 34 deletions(-) create mode 100644 .readthedocs.yaml create mode 100644 docs/api_document/async_api.md create mode 100644 docs/api_document/sync_api.md create mode 100644 docs/css/main.css create mode 100644 docs/gen_doc.py create mode 100644 docs/index.md create mode 100644 docs/req.in create mode 100644 mkdocs.yml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..5e3dde8 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,26 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + + +build: + os: ubuntu-22.04 + tools: + python: "3.11" + commands: + - pip install pip-tools + - pip-compile '.\docs\req.in' + - pip install -r docs/req.txt + - python setup.py install + - cd docs && python gen_doc.py + +mkdocs: + configuration: mkdocs.yml + +# Optionally declare the Python requirements required to build your docs +python: + install: + - requirements: docs/req.txt \ No newline at end of file diff --git a/docs/api_document/async_api.md b/docs/api_document/async_api.md new file mode 100644 index 0000000..0c875c5 --- /dev/null +++ b/docs/api_document/async_api.md @@ -0,0 +1,162 @@ +# mbbank.MBBankAsync(username, password, tesseract_path) +: Core Async class + + **Attributes** + +deviceIdCommon (str): Device id common + +sessionId (str or None): Current Session id + + **Parameters** + +`username` (str): MBBank Account Username + +`password` (str): MBBank Account Password + +`tesseract_path` (str): Tesseract path. Defaults to None. + + +### async getBalance() +: Get all main account and sub account balance + + **Returns** + + success (dict): list account balance + + **Raises** + + MBBankError: if api response not ok + + +### async getBalanceLoyalty() +: Get Account loyalty rank and Member loyalty point + + **Returns** + + success (dict): loyalty point + + **Raises** + + MBBankError: if api response not ok + + +### async getCardList() +: Get all card list from your account + + **Returns** + + success (dict): card list + + **Raises** + + MBBankError: if api response not ok + + +### async getCardTransactionHistory(cardNo, from_date, to_date) +: Get card transaction history + + **Parameters** + +`cardNo` (str): card number get from getCardList + +`from_date` (datetime.datetime): from date + +`to_date` (datetime.datetime): to date + + **Returns** + + success (dict): card transaction history + + **Raises** + + MBBankError: if api response not ok + + +### async getFavorBeneficiaryList(transactionType, searchType) +: Get all favor or most transfer beneficiary list from your account + + **Parameters** + +`transactionType` (Literal["TRANSFER", "PAYMENT"]): transaction type + +`searchType` (Literal["MOST", "LATEST"]): search type + + **Returns** + + success (dict): favor beneficiary list + + **Raises** + + MBBankError: if api response not ok + + +### async getInterestRate(currency) +: Get saving interest rate + + **Parameters** + +`currency` (str): currency ISO 4217 format. Defaults to "VND" (Viet Nam Dong). + + **Returns** + + success (dict): interest rate + + **Raises** + + MBBankError: if api response not ok + + +### async getLoanList() +: Get all loan list from your account + + **Returns** + + success (dict): loan list + + **Raises** + + MBBankError: if api response not ok + + +### async getSavingList() +: Get all saving list from your account + + **Returns** + + success (dict): saving list + + **Raises** + + MBBankError: if api response not ok + + +### async getTransactionAccountHistory(accountNo, from_date, to_date) +: Get account transaction history + + **Parameters** + +`accountNo` (str): Sub account number Defaults to Main Account number. + +`from_date` (datetime.datetime): transaction from date + +`to_date` (datetime.datetime): transaction to date + + **Returns** + + success (dict): account transaction history + + **Raises** + + MBBankError: if api response not ok + + +### async userinfo() +: Get current user info + + **Returns** + + success (dict): user info + + **Raises** + + MBBankError: if api response not ok diff --git a/docs/api_document/sync_api.md b/docs/api_document/sync_api.md new file mode 100644 index 0000000..521716f --- /dev/null +++ b/docs/api_document/sync_api.md @@ -0,0 +1,162 @@ +# mbbank.MBBank(username, password, tesseract_path) +: Core class + + **Attributes** + +deviceIdCommon (str): Device id common + +sessionId (str or None): Current Session id + + **Parameters** + +`username` (str): MBBank Account Username + +`password` (str): MBBank Account Password + +`tesseract_path` (str): Tesseract path. Defaults to None. + + +### getBalance() +: Get all main account and sub account balance + + **Returns** + + success (dict): list account balance + + **Raises** + + MBBankError: if api response not ok + + +### getBalanceLoyalty() +: Get Account loyalty rank and Member loyalty point + + **Returns** + + success (dict): loyalty point + + **Raises** + + MBBankError: if api response not ok + + +### getCardList() +: Get all card list from your account + + **Returns** + + success (dict): card list + + **Raises** + + MBBankError: if api response not ok + + +### getCardTransactionHistory(cardNo, from_date, to_date) +: Get card transaction history + + **Parameters** + +`cardNo` (str): card number get from getCardList + +`from_date` (datetime.datetime): from date + +`to_date` (datetime.datetime): to date + + **Returns** + + success (dict): card transaction history + + **Raises** + + MBBankError: if api response not ok + + +### getFavorBeneficiaryList(transactionType, searchType) +: Get all favor or most transfer beneficiary list from your account + + **Parameters** + +`transactionType` (Literal["TRANSFER", "PAYMENT"]): transaction type + +`searchType` (Literal["MOST", "LATEST"]): search type + + **Returns** + + success (dict): favor beneficiary list + + **Raises** + + MBBankError: if api response not ok + + +### getInterestRate(currency) +: Get saving interest rate + + **Parameters** + +`currency` (str): currency ISO 4217 format. Defaults to "VND" (Viet Nam Dong). + + **Returns** + + success (dict): interest rate + + **Raises** + + MBBankError: if api response not ok + + +### getLoanList() +: Get all loan list from your account + + **Returns** + + success (dict): loan list + + **Raises** + + MBBankError: if api response not ok + + +### getSavingList() +: Get all saving list from your account + + **Returns** + + success (dict): saving list + + **Raises** + + MBBankError: if api response not ok + + +### getTransactionAccountHistory(accountNo, from_date, to_date) +: Get account transaction history + + **Parameters** + +`accountNo` (str): Sub account number Defaults to Main Account number. + +`from_date` (datetime.datetime): transaction from date + +`to_date` (datetime.datetime): transaction to date + + **Returns** + + success (dict): account transaction history + + **Raises** + + MBBankError: if api response not ok + + +### userinfo() +: Get current user info + + **Returns** + + success (dict): user info + + **Raises** + + MBBankError: if api response not ok diff --git a/docs/css/main.css b/docs/css/main.css new file mode 100644 index 0000000..e69de29 diff --git a/docs/gen_doc.py b/docs/gen_doc.py new file mode 100644 index 0000000..1adc5bc --- /dev/null +++ b/docs/gen_doc.py @@ -0,0 +1,92 @@ +import asyncio +from griffe.dataclasses import Docstring +from griffe.enumerations import DocstringSectionKind +from mbbank import MBBank, MBBankAsync + + +def parse_doc(class_doc): + list_docs = [] + doc_main = Docstring(class_doc.__doc__) + docs_pr = doc_main.parse("google") + doc_md = {} + doc_md["name"] = "mbbank." + class_doc.__qualname__ + for i in docs_pr: + if i.kind is DocstringSectionKind.text: + doc_md["doc"] = i.value + elif i.kind is DocstringSectionKind.attributes: + doc_md["attributes"] = [i.as_dict() for i in i.value] + elif i.kind is DocstringSectionKind.parameters: + doc_md["parameters"] = [i.as_dict() for i in i.value] + list_docs.append(doc_md) + for i in dir(class_doc): + attb = getattr(class_doc, i) + if i.startswith("_") or attb.__doc__ is None: + continue + elif not callable(attb): + continue + doc_main = Docstring(attb.__doc__) + docs_pr = doc_main.parse("google") + doc_md = {"name": attb.__name__} + if asyncio.iscoroutinefunction(attb): + doc_md["name"] = "async " + doc_md["name"] + for i in docs_pr: + if i.kind is DocstringSectionKind.text: + doc_md["doc"] = i.value + elif i.kind is DocstringSectionKind.attributes: + doc_md["attributes"] = [i.as_dict() for i in i.value] + elif i.kind is DocstringSectionKind.parameters: + doc_md["parameters"] = [i.as_dict() for i in i.value] + elif i.kind is DocstringSectionKind.returns: + doc_md["returns"] = [i.as_dict() for i in i.value] + elif i.kind is DocstringSectionKind.raises: + doc_md["raises"] = [i.as_dict() for i in i.value] + list_docs.append(doc_md) + return list_docs + + +def from_list_to_md(doc_list): + str_out = [] + + def out(s=""): + str_out.append(s) + + for n, it in enumerate(doc_list): + pram = "" if "parameters" not in it else ", ".join([pr["name"] for pr in it["parameters"]]) + if n == 0: + out(f"# {it['name']}({pram})") + else: + out(f"\n### {it['name']}({pram})") + if "doc" in it: + out(f": {it['doc']}") + if "attributes" in it: + out("\n **Attributes**") + for j in it["attributes"]: + out() + out(f"{j['name']} ({j['annotation']}): {j['description']}") + if "parameters" in it: + out("\n **Parameters**") + for j in it["parameters"]: + out() + out(f"`{j['name']}` ({j['annotation']}): {j['description']}") + if "returns" in it: + out("\n **Returns**") + for j in it["returns"]: + out() + out(f" {j['name']} ({j['annotation']}): {j['description']}") + if "raises" in it: + out("\n **Raises**") + for j in it["raises"]: + out(f"\n {j['annotation']}: {j['description']}") + out() + return "\n".join(str_out) + + +with open("./docs/api_document/sync_api.md", "w") as f: + data = from_list_to_md(parse_doc(MBBank)) + f.write(data) + +with open("./docs/api_document/async_api.md", "w") as f: + data = from_list_to_md(parse_doc(MBBankAsync)) + f.write(data) + + diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..0b50764 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,16 @@ +# Welcome to MBBank API for Python + +## Why we have this lib ? + +Because I don't want to lose money on some api services like [casso.vn](https://casso.vn/) or [payos.vn](https://payos.vn/) +when have freemium tier but with limit :> + +what you need that it use this lib to make your own code so you can use it free forever + +## Requires + [tesseract (windows)](https://github.com/UB-Mannheim/tesseract/wiki) + + [tesseract (Linux & Mac)](https://github.com/tesseract-ocr/tessdoc/blob/main/Installation.md) + + + and python3 \ No newline at end of file diff --git a/docs/req.in b/docs/req.in new file mode 100644 index 0000000..3b361aa --- /dev/null +++ b/docs/req.in @@ -0,0 +1,4 @@ +mkdocs +mkdocstrings[python] +markdown-include +griffe diff --git a/mbbank/__init__.py b/mbbank/__init__.py index 43e02f9..955e614 100644 --- a/mbbank/__init__.py +++ b/mbbank/__init__.py @@ -1,4 +1,4 @@ -from .main import MBBank +from .main import MBBank, MBBankError from .mbasync import MBBankAsync -__version__ = '0.1.2' +__version__ = '0.1.3' diff --git a/mbbank/main.py b/mbbank/main.py index 635b2ac..4d37736 100644 --- a/mbbank/main.py +++ b/mbbank/main.py @@ -25,7 +25,25 @@ def get_now_time(): return now.strftime(f"%Y%m%d%H%M{microsecond}") +class MBBankError(Exception): + def __init__(self, err_out): + self.code = err_out['responseCode'] + self.message = err_out['message'] + super().__init__(f"{err_out['responseCode']} | {err_out['message']}") + + class MBBank: + """Core class + + Attributes: + deviceIdCommon (str): Device id common + sessionId (str or None): Current Session id + + Args: + username (str): MBBank Account Username + password (str): MBBank Account Password + tesseract_path (str, optional): Tesseract path. Defaults to None. + """ deviceIdCommon = f'i1vzyjp5-mbib-0000-0000-{get_now_time()}' def __init__(self, *, username, password, tesseract_path=None): @@ -44,7 +62,7 @@ def _req(self, url, *, json=None, headers=None): json = {} while True: if self.sessionId is None: - self.authenticate() + self._authenticate() rid = f"{self.__userid}-{get_now_time()}" json_data = { 'sessionId': self.sessionId if self.sessionId is not None else "", @@ -65,13 +83,13 @@ def _req(self, url, *, json=None, headers=None): data_out.pop("result", None) break elif data_out["result"]["responseCode"] == "GW200": - self.authenticate() + self._authenticate() else: err_out = data_out["result"] - raise Exception(f"{err_out['responseCode']} | {err_out['message']}") + raise MBBankError(err_out) return data_out - def authenticate(self): + def _authenticate(self): while True: self._userinfo = None self.sessionId = None @@ -122,7 +140,26 @@ def authenticate(self): err_out = data_out["result"] raise Exception(f"{err_out['responseCode']} | {err_out['message']}") - def getTransactionAccountHistory(self, *, accountNo:str=None, from_date: datetime.datetime, to_date: datetime.datetime): + def getTransactionAccountHistory(self, *, accountNo: str = None, from_date: datetime.datetime, + to_date: datetime.datetime): + """ + Get account transaction history + + Args: + accountNo (str, optional): Sub account number Defaults to Main Account number. + from_date (datetime.datetime): transaction from date + to_date (datetime.datetime): transaction to date + + Returns: + success (dict): account transaction history + + Raises: + MBBankError: if api response not ok + """ + if self._userinfo is None: + self._authenticate() + if accountNo is None: + accountNo = self._userinfo["result"]["data"]["accountNo"] json_data = { 'accountNo': self.__userid if accountNo is None else accountNo, 'fromDate': from_date.strftime("%d/%m/%Y"), @@ -134,14 +171,46 @@ def getTransactionAccountHistory(self, *, accountNo:str=None, from_date: datetim return data_out def getBalance(self): + """ + Get all main account and sub account balance + + Returns: + success (dict): list account balance + + Raises: + MBBankError: if api response not ok + """ + if self._userinfo is None: + self._authenticate() data_out = self._req("https://online.mbbank.com.vn/api/retail-web-accountms/getBalance") return data_out def getBalanceLoyalty(self): + """ + Get Account loyalty rank and Member loyalty point + + Returns: + success (dict): loyalty point + + Raises: + MBBankError: if api response not ok + """ data_out = self._req("https://online.mbbank.com.vn/api/retail_web/loyalty/getBalanceLoyalty") return data_out def getInterestRate(self, currency: str = "VND"): + """ + Get saving interest rate + + Args: + currency (str, optional): currency ISO 4217 format. Defaults to "VND" (Viet Nam Dong). + + Returns: + success (dict): interest rate + + Raises: + MBBankError: if api response not ok + """ json_data = { "productCode": "TIENGUI.KHN.EMB", "currency": currency, @@ -151,6 +220,19 @@ def getInterestRate(self, currency: str = "VND"): def getFavorBeneficiaryList(self, *, transactionType: typing.Literal["TRANSFER", "PAYMENT"], searchType: typing.Literal["MOST", "LATEST"]): + """ + Get all favor or most transfer beneficiary list from your account + + Args: + transactionType (Literal["TRANSFER", "PAYMENT"]): transaction type + searchType (Literal["MOST", "LATEST"]): search type + + Returns: + success (dict): favor beneficiary list + + Raises: + MBBankError: if api response not ok + """ json_data = { "transactionType": transactionType, "searchType": searchType @@ -160,32 +242,82 @@ def getFavorBeneficiaryList(self, *, transactionType: typing.Literal["TRANSFER", return data_out def getCardList(self): + """ + Get all card list from your account + + Returns: + success (dict): card list + + Raises: + MBBankError: if api response not ok + """ data_out = self._req("https://online.mbbank.com.vn/api/retail_web/card/getList") return data_out def getSavingList(self): + """ + Get all saving list from your account + + Returns: + success (dict): saving list + + Raises: + MBBankError: if api response not ok + """ data_out = self._req("https://online.mbbank.com.vn/api/retail_web/saving/getList") return data_out def getLoanList(self): + """ + Get all loan list from your account + + Returns: + success (dict): loan list + + Raises: + MBBankError: if api response not ok + """ data_out = self._req("https://online.mbbank.com.vn/api/retail_web/loan/getList") return data_out - def getCardTransactionHistory(self, cardNo:str, from_date: datetime.datetime, to_date: datetime.datetime): + def getCardTransactionHistory(self, cardNo: str, from_date: datetime.datetime, to_date: datetime.datetime): + """ + Get card transaction history + + Args: + cardNo (str): card number get from getCardList + from_date (datetime.datetime): from date + to_date (datetime.datetime): to date + + Returns: + success (dict): card transaction history + + Raises: + MBBankError: if api response not ok + """ json_data = { - "accountNo": cardNo, - "fromDate": from_date.strftime("%d/%m/%Y"), - "toDate": to_date.strftime("%d/%m/%Y"), # max 3 months - "historyNumber": "", - "historyType": "DATE_RANGE", - "type": "CARD", + "accountNo": cardNo, + "fromDate": from_date.strftime("%d/%m/%Y"), + "toDate": to_date.strftime("%d/%m/%Y"), # max 3 months + "historyNumber": "", + "historyType": "DATE_RANGE", + "type": "CARD", } data_out = self._req("https://online.mbbank.com.vn/api/retail_web/common/getTransactionHistory", json=json_data) return data_out def userinfo(self): + """ + Get current user info + + Returns: + success (dict): user info + + Raises: + MBBankError: if api response not ok + """ if self._userinfo is None: - self.authenticate() + self._authenticate() else: self.getBalance() return self._userinfo diff --git a/mbbank/mbasync.py b/mbbank/mbasync.py index e3b442a..ab250e1 100644 --- a/mbbank/mbasync.py +++ b/mbbank/mbasync.py @@ -8,6 +8,7 @@ import io import platform import aiohttp +from .main import MBBankError headers_default = { 'Cache-Control': 'no-cache', @@ -26,6 +27,17 @@ def get_now_time(): class MBBankAsync: + """Core Async class + + Attributes: + deviceIdCommon (str): Device id common + sessionId (str or None): Current Session id + + Args: + username (str): MBBank Account Username + password (str): MBBank Account Password + tesseract_path (str, optional): Tesseract path. Defaults to None. + """ deviceIdCommon = f'i1vzyjp5-mbib-0000-0000-{get_now_time()}' def __init__(self, *, username, password, tesseract_path=None): @@ -40,7 +52,7 @@ def __init__(self, *, username, password, tesseract_path=None): async def _req(self, url, *, json={}, headers={}): while True: if self.sessionId is None: - await self.authenticate() + await self._authenticate() rid = f"{self.__userid}-{get_now_time()}" json_data = { 'sessionId': self.sessionId if self.sessionId is not None else "", @@ -61,13 +73,13 @@ async def _req(self, url, *, json={}, headers={}): data_out.pop("result", None) break elif data_out["result"]["responseCode"] == "GW200": - await self.authenticate() + await self._authenticate() else: err_out = data_out["result"] - raise Exception(f"{err_out['responseCode']} | {err_out['message']}") + raise MBBankError(err_out) return data_out - async def authenticate(self): + async def _authenticate(self): while True: self._userinfo = None self.sessionId = None @@ -120,6 +132,20 @@ async def authenticate(self): async def getTransactionAccountHistory(self, *, accountNo: str = None, from_date: datetime.datetime, to_date: datetime.datetime): + """ + Get account transaction history + + Args: + accountNo (str, optional): Sub account number Defaults to Main Account number. + from_date (datetime.datetime): transaction from date + to_date (datetime.datetime): transaction to date + + Returns: + success (dict): account transaction history + + Raises: + MBBankError: if api response not ok + """ json_data = { 'accountNo': self.__userid if accountNo is None else accountNo, 'fromDate': from_date.strftime("%d/%m/%Y"), @@ -131,23 +157,66 @@ async def getTransactionAccountHistory(self, *, accountNo: str = None, from_date return data_out async def getBalance(self): + """ + Get all main account and sub account balance + + Returns: + success (dict): list account balance + + Raises: + MBBankError: if api response not ok + """ data_out = await self._req("https://online.mbbank.com.vn/api/retail-web-accountms/getBalance") return data_out async def getBalanceLoyalty(self): + """ + Get Account loyalty rank and Member loyalty point + + Returns: + success (dict): loyalty point + + Raises: + MBBankError: if api response not ok + """ data_out = await self._req("https://online.mbbank.com.vn/api/retail_web/loyalty/getBalanceLoyalty") return data_out async def getInterestRate(self, currency: str = "VND"): + """ + Get saving interest rate + + Args: + currency (str, optional): currency ISO 4217 format. Defaults to "VND" (Viet Nam Dong). + + Returns: + success (dict): interest rate + + Raises: + MBBankError: if api response not ok + """ json_data = { "productCode": "TIENGUI.KHN.EMB", - "currency": currency, + "currency": currency } data_out = await self._req("https://online.mbbank.com.vn/api/retail_web/saving/getInterestRate", json=json_data) return data_out async def getFavorBeneficiaryList(self, *, transactionType: typing.Literal["TRANSFER", "PAYMENT"], searchType: typing.Literal["MOST", "LATEST"]): + """ + Get all favor or most transfer beneficiary list from your account + + Args: + transactionType (Literal["TRANSFER", "PAYMENT"]): transaction type + searchType (Literal["MOST", "LATEST"]): search type + + Returns: + success (dict): favor beneficiary list + + Raises: + MBBankError: if api response not ok + """ json_data = { "transactionType": transactionType, "searchType": searchType @@ -157,24 +226,89 @@ async def getFavorBeneficiaryList(self, *, transactionType: typing.Literal["TRAN return data_out async def getCardList(self): + """ + Get all card list from your account + + Returns: + success (dict): card list + + Raises: + MBBankError: if api response not ok + """ data_out = await self._req("https://online.mbbank.com.vn/api/retail_web/card/getList") return data_out async def getSavingList(self): + """ + Get all saving list from your account + + Returns: + success (dict): saving list + + Raises: + MBBankError: if api response not ok + """ data_out = await self._req("https://online.mbbank.com.vn/api/retail_web/saving/getList") return data_out async def getLoanList(self): + """ + Get all loan list from your account + + Returns: + success (dict): loan list + + Raises: + MBBankError: if api response not ok + """ data_out = await self._req("https://online.mbbank.com.vn/api/retail_web/loan/getList") return data_out + async def getCardTransactionHistory(self, cardNo: str, from_date: datetime.datetime, to_date: datetime.datetime): + """ + Get card transaction history + + Args: + cardNo (str): card number get from getCardList + from_date (datetime.datetime): from date + to_date (datetime.datetime): to date + + Returns: + success (dict): card transaction history + + Raises: + MBBankError: if api response not ok + """ + json_data = { + "accountNo": cardNo, + "fromDate": from_date.strftime("%d/%m/%Y"), + "toDate": to_date.strftime("%d/%m/%Y"), # max 3 months + "historyNumber": "", + "historyType": "DATE_RANGE", + "type": "CARD", + } + data_out = await self._req("https://online.mbbank.com.vn/api/retail_web/common/getTransactionHistory", + json=json_data) + return data_out + async def userinfo(self): + """ + Get current user info + + Returns: + success (dict): user info + + Raises: + MBBankError: if api response not ok + """ if self._userinfo is None: - await self.authenticate() + await self._authenticate() else: await self.getBalance() return self._userinfo + # working on beta + async def getBankList(self): data_out = await self._req("https://online.mbbank.com.vn/api/retail_web/common/getBankList") return data_out @@ -238,16 +372,3 @@ async def getAccountByPhone(self, phone: str): data_out = await self._req("https://online.mbbank.com.vn/api/retail_web/common/getAccountByPhone", json=json_data) return data_out - - async def getCardTransactionHistory(self, cardNo: str, from_date: datetime.datetime, to_date: datetime.datetime): - json_data = { - "accountNo": cardNo, - "fromDate": from_date.strftime("%d/%m/%Y"), - "toDate": to_date.strftime("%d/%m/%Y"), # max 3 months - "historyNumber": "", - "historyType": "DATE_RANGE", - "type": "CARD", - } - data_out = await self._req("https://online.mbbank.com.vn/api/retail_web/common/getTransactionHistory", - json=json_data) - return data_out diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..a74ebc8 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,22 @@ +site_name: MBBank + +repo_url: https://github.com/thedtvn/MBBank + +nav: + - Introduction: 'index.md' + - 'API Documentation': + - "Async API": 'api_document/async_api.md' + - "Sync API": 'api_document/sync_api.md' + +exclude_docs: | + req.* + *.py + +extra_css: + - css/main.css + +markdown_extensions: + - attr_list + - def_list + - toc: + permalink: true \ No newline at end of file