Skip to main content

Python wrapper for making secure requests to Kuda API

Project description

kudapy

Python wrapper for making secure requests to Kuda API

Getting started

  • register on kuda bank website to recieve public and private keys in xml format
  • paste your private and public keys (both in PEM format) in your project directory - both keys come in XML format(YOU NEED TO CONVERT FROM XML TO PEM)
  • Your client key is the name of your private key file sent after registration on kuda bank website.

Installation

pip install kudapy

Library setup

from kudapy.base_api import kuda
import math
import random
from kuda.utils import generate_id, load_private_key, load_public_key



client_key = "name-of-private-key-file"

# load private and public keys

"""
kuda.utils contains 3 utility functions: generate_id, load_private_key and load_public_key
these are not required but would make life easier
"""

private_key = load_private_key() #you have to rename your private key .pem file to private.pem
public_key = load_public_key()	#you have to rename your public key .pem file to public.pem

Making a request

#the kuda function expects at most 3 parameters: service_type, request_ref and data
#not all requests require the last parameter (data). see sample request below.


kuda(service_type, request_ref, data)

Refer to the Kuda Bank API documentation for respective SERVICE TYPES and DATA TYPES

Sample requests

# Bank List

#generate a random request_reference
request_ref = math.floor(random.random() * 1000000000000 + 1)

kuda(public_key, private_key, client_key)("BANK_LIST", request_ref)


#-------------------------------------------------------------------

#Create a Virtual Account

#generate a random request_reference
request_ref = math.floor(random.random() * 1000000000000 + 1)

#generate a random tracking_reference id
short_ref_id = generate_id(5)
tracking_reference = f"vAcc{short_ref_id}"


kuda(public_key, private_key, client_key)("CREATE_VIRTUAL_ACCOUNT", request_ref, {
    "email": "okonkwo_yusuf@kudabank.com",
    "phoneNumber": "07011111111",
    "firstName": "Okonkwo",
    "lastName": "Yusuf",
    "trackingReference": tracking_reference
})


## expected response is decrypted data from Kuda API in JSON

Contribution & Issues

  • Simply fork the repo, make changes and make a pull request
  • You can open an issue for support or suggestions

Author

Acknowledgements

  • Kuda Bank Team
  • Cowrywise 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

kudapy-1.0.4.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

kudapy-1.0.4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file kudapy-1.0.4.tar.gz.

File metadata

  • Download URL: kudapy-1.0.4.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for kudapy-1.0.4.tar.gz
Algorithm Hash digest
SHA256 dff5f5f8d69cb200634a34e31f340633998cbbd50932d49cda741953d44e0f77
MD5 aeb3ed4b3d473decaa0768e1836a3cb9
BLAKE2b-256 adf7debd633eb0715886cf311ae6f531678f2411f0b8c70f5e65f5b0bdd4583c

See more details on using hashes here.

File details

Details for the file kudapy-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: kudapy-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for kudapy-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bed3d7e9b828b779dabeff3958819fd7c48faef6ca08ff59503e76d95f36a373
MD5 ed1a2a29aa88e5b81fb867ad1f51de07
BLAKE2b-256 03f30719dc6b28d494d1dd137fa61a8fde531fd86528beefd928988e2553db7c

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