Skip to main content

Kuda OpenAPI Python Library

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kuda-python-1.0.2.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kuda_python-1.0.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file kuda-python-1.0.2.tar.gz.

File metadata

  • Download URL: kuda-python-1.0.2.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.4

File hashes

Hashes for kuda-python-1.0.2.tar.gz
Algorithm Hash digest
SHA256 55a345df4aa1a4cdbec379e454ba10581df0139f0edf8bbcc1606ef62ace2ca7
MD5 79a087767ec7cb0b2ca7ec75c931cd61
BLAKE2b-256 3bdd54cbdb0fda60bb87d6064283e950aa66d4a11332e044f4b2b4c590219fca

See more details on using hashes here.

File details

Details for the file kuda_python-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: kuda_python-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.4

File hashes

Hashes for kuda_python-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7295b32cfcb172e5c8733ebdd17be6b7824e9806e73ad778401dc7b7615f2edd
MD5 a9e034d38025e8ce217c8c2279a90ae5
BLAKE2b-256 59529a63a4fce51e18f930cfc2466c5b35c3d65bc3ca7642d4f5f4e9ade8d43d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page