Skip to main content

Kuda OpenAPI Python Library

DocumentationCode StyleLicense: MIT

This is a lightweight library that works as a connector to Kuda OpenAPI.

  • Customizable base URL.

  • Response metadata can be displayed.

  • Included examples.

Upcoming

  • Savings endpoints,

  • Example cases,

  • HTTP proxy.

Installation


pip install kuda-python

Documentation

https://kuda-python.readthedocs.io

Getting started

  • Load your email and apiKey to the Kuda client (JSON or dotenv is recommended).
  • JWT tokens are automatically generated.

Usage examples:

from kuda import Kuda



# email and apiKey are generated from your Kuda developer dashboard

Kuda = Kuda(email='<email>', apiKey='<liveApiKey>', show_request=True, sandbox=False, base_url="")



# Get bank list

print(Kuda.bank_list())



# Retrieve main account balance

print(Kuda.get_main_account_balance())



# Perform name enquiry

print(Kuda.name_enquiry(2005161838, "090267"))



# Create virtual account

params = {

    'lastName': 'Manuel',

    'firstName': 'Infosec',

    'email': 'manuelinfosec@gmail.cm',

    'phoneNumber': "+2349131103073",

    'trackingRef': Kuda.get_ref(10) # you can generate your trackingReference some other way you choose.

}

  

print(Kuda.create_virtual_account(**params))

Kuda OpenAPI Test

Kuda Test is available too.

To use Kuda OpenAPI on Test, switch to test on your dashboard and copy apiKey (Live apiKey still remains valid):

from kuda import Kuda



# email and apiKey are generated from your Kuda developer dashboard

Kuda = Kuda(email='<email>', apiKey='<testApiKey>', show_request=True, sandbox=False, base_url="")





# Get bank list

print(Kuda.bank_list())



# Retrieve main account balance

print(Kuda.get_main_account_balance())



# Perform name enquiry

print(Kuda.name_enquiry(2005161838, "999129"))





# Create virtual account



params = {

    'lastName': 'Manuel',

    'firstName': 'Infosec',

    'email': 'manuelinfosec@gmail.cm',

    'phoneNumber': "+2349131103073",

    'trackingRef': Kuda.get_ref(10) # you can generate your trackingReference some other way you choose.

}



  

print(Kuda.create_virtual_account(**params))

Base URL

If not provided, base_url defaults to https://kuda-openapi.kuda.com/v2 if sandbox=False, or https://kuda-openapi-uat.kudabank.com/v2 if sandbox=True.

Changes to the Kuda OpenAPI URL will reflect in future updates. In the case of late update, it is recommended to pass in the base_url parameter.

Request and Response Metadata

This library provies requests and header data for debugging purposes.

You can display them by initializing the client with show_request=True or show_header=True respectively:

from kuda import Kuda



# email and apiKey are generated from your Kuda developer dashboard

Kuda = Kuda(email='<email>', apiKey='<liveApiKey>', show_request=True, show_header=True, sandbox=False, base_url="")



# Get bank list

print(Kuda.bank_list())

returns:

{'headers': {'User-Agent': 'python-requests/2.27.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Authorization': 'Bearer <JWT_TOKEN>', 'Content-Length': '77', 'Content-Type': 'application/json'}, 'body': {'data': '<REDACTED>', 'password': ''}}

You can also display full response metadata to help in debugging:

Kuda = Kuda(email='<email>', apiKey='<liveApiKey>', show_request=True, sandbox=False, base_url="")



# Get bank list

print(Kuda.bank_list())

returns:

{

    "data": "{'serviceType': 'BANK_LIST', 'requestRef': '9903712', 'data': {}}"

}

# <API RESPONSE>

Refer to documentation for respective data types for each fields in the payload

If ClientError is received, it'll display full header meta information.

Error

There are 2 types of errors returned from the library:

  • kuda.error.ClientError

    - This is thrown when server returns 4XX, it's an issue from client side.

    - It has 3 properties:

        - status_code - HTTP status code, e.g. -404

        - error_message - Server's error message, e.g. Something went wrong

        - header - Full response header.

  • kuda.error.ServerError

    - This is thrown when server returns 5XX, it's an issue from server side.

Contributing

Contributions are welcome.

If you've found a bug within this project, please open an issue to discuss what you would like to change.

If you have any questions, feature requests, or notice any errors with the OpenAPI, please reach out to Kuda, creating a //Skype link and someone will respond.

Authors

Manuel

Acknowledgments

Kuda Bank Team

Metadata

Release files for kuda-python 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kuda-python 1.0.2
File Size Uploaded
kuda-python-1.0.2.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kuda-python 1.0.2
File Interpreter ABI Platform
kuda_python-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.4 kB

Release files / kuda-python-1.0.2.tar.gz

Download URL kuda-python-1.0.2.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
55a345df4aa1a4cdbec379e454ba10581df0139f0edf8bbcc1606ef62ace2ca7
BLAKE2b-256 checksum
How to use checksums
3bdd54cbdb0fda60bb87d6064283e950aa66d4a11332e044f4b2b4c590219fca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.4

Release files / kuda_python-1.0.2-py3-none-any.whl

Download URL kuda_python-1.0.2-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7295b32cfcb172e5c8733ebdd17be6b7824e9806e73ad778401dc7b7615f2edd
BLAKE2b-256 checksum
How to use checksums
59529a63a4fce51e18f930cfc2466c5b35c3d65bc3ca7642d4f5f4e9ade8d43d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.4

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

1 release file

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page