https://github.com/victor-abz/msacco_api
https://github.com/victor-abz/msacco_api
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/victor-abz/msacco_api
- Owner: victor-abz
- License: other
- Created: 2022-11-13T15:10:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-23T15:15:37.000Z (over 2 years ago)
- Last Synced: 2025-02-09T05:41:22.446Z (4 months ago)
- Language: Python
- Size: 69.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
README
## The Central API
API to centralize MSACCO transactions
Build a Simple CBS DB connector.
### Usage
In any python file:```py
import frappe
from msacco_api.cbs_db import PostgresDatabasedef get_cbs_root_connection(root_login, root_password):
import getpassif not frappe.local.flags.root_cbs_connection:
if not root_login:
root_login = "root"if not root_password:
root_password = frappe.conf.get("root_password") or Noneif not root_password:
root_password = getpass.getpass("Corebanking root password: ")frappe.local.flags.root_cbs_connection = PostgresDatabase(
user=root_login, password=root_password
)return frappe.local.flags.root_cbs_connection
def check_connection():
root_conn = get_cbs_root_connection('db_username', 'db_password')
frappe.cbs_db = root_conn
# print(root_conn.describe('ad_cli'))
# print(root_conn.sql("SELECT * FROM ad_cli WHERE id_client = '10931'", as_dict=1))
# print(len(root_conn.get_values("ad_cpt", filters={"solde": ["!=", "0"]}, fieldname=["*"], order_by="id_titulaire asc", as_dict=1)))
# print(len(frappe.cbs_db.get_values("ad_cli")))
root_conn.close()```
#### License
MIT