ng-fintech-utils 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ng_fintech_utils-0.1.0/PKG-INFO +97 -0
- ng_fintech_utils-0.1.0/README.md +85 -0
- ng_fintech_utils-0.1.0/ng_fintech_utils/__init__.py +0 -0
- ng_fintech_utils-0.1.0/ng_fintech_utils/client.py +22 -0
- ng_fintech_utils-0.1.0/ng_fintech_utils.egg-info/PKG-INFO +97 -0
- ng_fintech_utils-0.1.0/ng_fintech_utils.egg-info/SOURCES.txt +9 -0
- ng_fintech_utils-0.1.0/ng_fintech_utils.egg-info/dependency_links.txt +1 -0
- ng_fintech_utils-0.1.0/ng_fintech_utils.egg-info/requires.txt +1 -0
- ng_fintech_utils-0.1.0/ng_fintech_utils.egg-info/top_level.txt +1 -0
- ng_fintech_utils-0.1.0/pyproject.toml +17 -0
- ng_fintech_utils-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ng-fintech-utils
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A lightweight utility package for Nigerian fintech data, bank codes, and USSD tools.
|
|
5
|
+
Author-email: "Caleb A." <calebageb9@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: requests>=2.34.0
|
|
12
|
+
|
|
13
|
+
# 🇳🇬 ng-fintech-utils (Python)
|
|
14
|
+
|
|
15
|
+
A lightweight Python wrapper for the **NG Fintech Utils API**. Easily fetch Nigerian bank codes, NUBAN/sorting codes, and USSD strings directly in your Python applications.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📦 Installation
|
|
20
|
+
|
|
21
|
+
You can install the package directly from PyPI using pip:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install ng_fintech_utils
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🚀 Getting Started
|
|
30
|
+
|
|
31
|
+
The package provides a simple, synchronous client to interact with the fintech data.
|
|
32
|
+
|
|
33
|
+
### 1. Initialization
|
|
34
|
+
|
|
35
|
+
Import the client and initialize it. By default, it connects to the live production API. (You can also pass a custom `base_url` for local testing).
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from ng_fintech_utils.client import NG_FINTECH_UTILS
|
|
39
|
+
|
|
40
|
+
# Initialize the client
|
|
41
|
+
fintech = NG_FINTECH_UTILS()
|
|
42
|
+
|
|
43
|
+
# For local development against your Next.js server:
|
|
44
|
+
# fintech = NG_FINTECH_UTILS(base_url="http://localhost:3000/api")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Fetch All Banks
|
|
48
|
+
|
|
49
|
+
Retrieve a complete list of all supported commercial banks, their codes, and USSD strings.
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
banks = fintech.get_banks()
|
|
53
|
+
|
|
54
|
+
for bank in banks:
|
|
55
|
+
print(f"{bank['name']} - Code: {bank['code']} - USSD: {bank['ussd']}")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 3. Fetch a Single Bank
|
|
59
|
+
|
|
60
|
+
You can look up a specific bank using its URL-friendly `slug` or its 3-digit `code`. This is great for resolving bank details dynamically during a checkout flow.
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
# Lookup by 3-digit code
|
|
64
|
+
gtb = fintech.get_bank("058")
|
|
65
|
+
print(gtb['name']) # Output: Guaranty Trust Bank
|
|
66
|
+
|
|
67
|
+
# Lookup by slug
|
|
68
|
+
access = fintech.get_bank("access-bank")
|
|
69
|
+
print(access['ussd']) # Output: *901#
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 🛠️ Error Handling
|
|
75
|
+
|
|
76
|
+
The client will return `None` if a specific bank is not found, making it easy to write clean conditional checks:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
bank = fintech.get_bank("unknown-code")
|
|
80
|
+
|
|
81
|
+
if not bank:
|
|
82
|
+
print("Bank not found. Please check the code.")
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
If the API is unreachable or rate-limited, the client will raise an `Exception` with the corresponding HTTP status code.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 🔗 Ecosystem
|
|
90
|
+
|
|
91
|
+
This package is part of the broader **NG Fintech Utils** project. If you are a frontend developer, you can also query our free REST API directly without this wrapper.
|
|
92
|
+
|
|
93
|
+
See the [API Documentation](https://github.com/Sly611/ng-fintech-utils) for more details.
|
|
94
|
+
|
|
95
|
+
## 📄 License
|
|
96
|
+
|
|
97
|
+
MIT License
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# 🇳🇬 ng-fintech-utils (Python)
|
|
2
|
+
|
|
3
|
+
A lightweight Python wrapper for the **NG Fintech Utils API**. Easily fetch Nigerian bank codes, NUBAN/sorting codes, and USSD strings directly in your Python applications.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📦 Installation
|
|
8
|
+
|
|
9
|
+
You can install the package directly from PyPI using pip:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install ng_fintech_utils
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Getting Started
|
|
18
|
+
|
|
19
|
+
The package provides a simple, synchronous client to interact with the fintech data.
|
|
20
|
+
|
|
21
|
+
### 1. Initialization
|
|
22
|
+
|
|
23
|
+
Import the client and initialize it. By default, it connects to the live production API. (You can also pass a custom `base_url` for local testing).
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from ng_fintech_utils.client import NG_FINTECH_UTILS
|
|
27
|
+
|
|
28
|
+
# Initialize the client
|
|
29
|
+
fintech = NG_FINTECH_UTILS()
|
|
30
|
+
|
|
31
|
+
# For local development against your Next.js server:
|
|
32
|
+
# fintech = NG_FINTECH_UTILS(base_url="http://localhost:3000/api")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Fetch All Banks
|
|
36
|
+
|
|
37
|
+
Retrieve a complete list of all supported commercial banks, their codes, and USSD strings.
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
banks = fintech.get_banks()
|
|
41
|
+
|
|
42
|
+
for bank in banks:
|
|
43
|
+
print(f"{bank['name']} - Code: {bank['code']} - USSD: {bank['ussd']}")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3. Fetch a Single Bank
|
|
47
|
+
|
|
48
|
+
You can look up a specific bank using its URL-friendly `slug` or its 3-digit `code`. This is great for resolving bank details dynamically during a checkout flow.
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
# Lookup by 3-digit code
|
|
52
|
+
gtb = fintech.get_bank("058")
|
|
53
|
+
print(gtb['name']) # Output: Guaranty Trust Bank
|
|
54
|
+
|
|
55
|
+
# Lookup by slug
|
|
56
|
+
access = fintech.get_bank("access-bank")
|
|
57
|
+
print(access['ussd']) # Output: *901#
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 🛠️ Error Handling
|
|
63
|
+
|
|
64
|
+
The client will return `None` if a specific bank is not found, making it easy to write clean conditional checks:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
bank = fintech.get_bank("unknown-code")
|
|
68
|
+
|
|
69
|
+
if not bank:
|
|
70
|
+
print("Bank not found. Please check the code.")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If the API is unreachable or rate-limited, the client will raise an `Exception` with the corresponding HTTP status code.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 🔗 Ecosystem
|
|
78
|
+
|
|
79
|
+
This package is part of the broader **NG Fintech Utils** project. If you are a frontend developer, you can also query our free REST API directly without this wrapper.
|
|
80
|
+
|
|
81
|
+
See the [API Documentation](https://github.com/Sly611/ng-fintech-utils) for more details.
|
|
82
|
+
|
|
83
|
+
## 📄 License
|
|
84
|
+
|
|
85
|
+
MIT License
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class NG_FINTECH_UTILS:
|
|
4
|
+
def __init__(self, base_url="http://192.168.18.7:3000/api"):
|
|
5
|
+
self.base_url = base_url
|
|
6
|
+
|
|
7
|
+
def get_banks(self):
|
|
8
|
+
|
|
9
|
+
response = requests.get(f"{self.base_url}/bank")
|
|
10
|
+
if response.status == 200:
|
|
11
|
+
return response.json().get("data")
|
|
12
|
+
|
|
13
|
+
raise Exception(f"Failed to fetch banks: {response.status_code}")
|
|
14
|
+
|
|
15
|
+
def get_bank(self, identifier):
|
|
16
|
+
"""Fetch a single bank by slug or code."""
|
|
17
|
+
response = requests.get(f"{self.base_url}/banks/{identifier}")
|
|
18
|
+
if response.status_code == 200:
|
|
19
|
+
return response.json().get("data")
|
|
20
|
+
elif response.status_code == 404:
|
|
21
|
+
return None
|
|
22
|
+
raise Exception(f"Error fetching bank: {response.status_code}")
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ng-fintech-utils
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A lightweight utility package for Nigerian fintech data, bank codes, and USSD tools.
|
|
5
|
+
Author-email: "Caleb A." <calebageb9@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: requests>=2.34.0
|
|
12
|
+
|
|
13
|
+
# 🇳🇬 ng-fintech-utils (Python)
|
|
14
|
+
|
|
15
|
+
A lightweight Python wrapper for the **NG Fintech Utils API**. Easily fetch Nigerian bank codes, NUBAN/sorting codes, and USSD strings directly in your Python applications.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📦 Installation
|
|
20
|
+
|
|
21
|
+
You can install the package directly from PyPI using pip:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install ng_fintech_utils
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🚀 Getting Started
|
|
30
|
+
|
|
31
|
+
The package provides a simple, synchronous client to interact with the fintech data.
|
|
32
|
+
|
|
33
|
+
### 1. Initialization
|
|
34
|
+
|
|
35
|
+
Import the client and initialize it. By default, it connects to the live production API. (You can also pass a custom `base_url` for local testing).
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from ng_fintech_utils.client import NG_FINTECH_UTILS
|
|
39
|
+
|
|
40
|
+
# Initialize the client
|
|
41
|
+
fintech = NG_FINTECH_UTILS()
|
|
42
|
+
|
|
43
|
+
# For local development against your Next.js server:
|
|
44
|
+
# fintech = NG_FINTECH_UTILS(base_url="http://localhost:3000/api")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Fetch All Banks
|
|
48
|
+
|
|
49
|
+
Retrieve a complete list of all supported commercial banks, their codes, and USSD strings.
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
banks = fintech.get_banks()
|
|
53
|
+
|
|
54
|
+
for bank in banks:
|
|
55
|
+
print(f"{bank['name']} - Code: {bank['code']} - USSD: {bank['ussd']}")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 3. Fetch a Single Bank
|
|
59
|
+
|
|
60
|
+
You can look up a specific bank using its URL-friendly `slug` or its 3-digit `code`. This is great for resolving bank details dynamically during a checkout flow.
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
# Lookup by 3-digit code
|
|
64
|
+
gtb = fintech.get_bank("058")
|
|
65
|
+
print(gtb['name']) # Output: Guaranty Trust Bank
|
|
66
|
+
|
|
67
|
+
# Lookup by slug
|
|
68
|
+
access = fintech.get_bank("access-bank")
|
|
69
|
+
print(access['ussd']) # Output: *901#
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 🛠️ Error Handling
|
|
75
|
+
|
|
76
|
+
The client will return `None` if a specific bank is not found, making it easy to write clean conditional checks:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
bank = fintech.get_bank("unknown-code")
|
|
80
|
+
|
|
81
|
+
if not bank:
|
|
82
|
+
print("Bank not found. Please check the code.")
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
If the API is unreachable or rate-limited, the client will raise an `Exception` with the corresponding HTTP status code.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 🔗 Ecosystem
|
|
90
|
+
|
|
91
|
+
This package is part of the broader **NG Fintech Utils** project. If you are a frontend developer, you can also query our free REST API directly without this wrapper.
|
|
92
|
+
|
|
93
|
+
See the [API Documentation](https://github.com/Sly611/ng-fintech-utils) for more details.
|
|
94
|
+
|
|
95
|
+
## 📄 License
|
|
96
|
+
|
|
97
|
+
MIT License
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
ng_fintech_utils/__init__.py
|
|
4
|
+
ng_fintech_utils/client.py
|
|
5
|
+
ng_fintech_utils.egg-info/PKG-INFO
|
|
6
|
+
ng_fintech_utils.egg-info/SOURCES.txt
|
|
7
|
+
ng_fintech_utils.egg-info/dependency_links.txt
|
|
8
|
+
ng_fintech_utils.egg-info/requires.txt
|
|
9
|
+
ng_fintech_utils.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.34.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ng_fintech_utils
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ng-fintech-utils"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A lightweight utility package for Nigerian fintech data, bank codes, and USSD tools."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "Caleb A.", email = "calebageb9@gmail.com" }]
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
]
|
|
17
|
+
dependencies = ["requests>=2.34.0"]
|