Package: kuda-python
Kuda OpenAPI Python LibraryThis is a lightweight library that works as a connector toKuda OpenAPI.Customizable base URL.Response metadata can be displayed.Included examples.UpcomingSavings endpoints,Example cases,HTTP proxy.Installationpip install kuda-pythonDocumentationhttps://kuda-python.readthedocs.ioGetting startedLogin to yourKuda dashboardand generate your apiKey.Load your email and apiKey to the Kuda client (JSON or dotenv is recommended).JWT tokens are automatically generated.Usage examples:fromkudaimportKuda# email and apiKey are generated from your Kuda developer dashboardKuda=Kuda(email='<email>',apiKey='<liveApiKey>',show_request=True,sandbox=False,base_url="")# Get bank listprint(Kuda.bank_list())# Retrieve main account balanceprint(Kuda.get_main_account_balance())# Perform name enquiryprint(Kuda.name_enquiry(2005161838,"090267"))# Create virtual accountparams={'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 TestKuda Testis available too.To use Kuda OpenAPI on Test, switch to test on your dashboard and copy apiKey (Live apiKey still remains valid):fromkudaimportKuda# email and apiKey are generated from your Kuda developer dashboardKuda=Kuda(email='<email>',apiKey='<testApiKey>',show_request=True,sandbox=False,base_url="")# Get bank listprint(Kuda.bank_list())# Retrieve main account balanceprint(Kuda.get_main_account_balance())# Perform name enquiryprint(Kuda.name_enquiry(2005161838,"999129"))# Create virtual accountparams={'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 URLIf not provided,base_urldefaults tohttps://kuda-openapi.kuda.com/v2ifsandbox=False, orhttps://kuda-openapi-uat.kudabank.com/v2ifsandbox=True.Changes to the Kuda OpenAPI URL will reflect in future updates. In the case of late update, it is recommended to pass in thebase_urlparameter.Request and Response MetadataThis library provies requests and header data for debugging purposes.You can display them by initializing the client withshow_request=Trueorshow_header=Truerespectively:fromkudaimportKuda# email and apiKey are generated from your Kuda developer dashboardKuda=Kuda(email='<email>',apiKey='<liveApiKey>',show_request=True,show_header=True,sandbox=False,base_url="")# Get bank listprint(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 listprint(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 payloadIfClientErroris received, it'll display full header meta information.ErrorThere are 2 types of errors returned from the library:kuda.error.ClientError- This is thrown when server returns4XX, 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 returns5XX, it's an issue from server side.ContributingContributions 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 toKuda, creating a //Skype link and someone will respond.AuthorsManuelAcknowledgmentsKuda Bank Team