Skip to main content

Python wrapper for Okra API

Project description

okra_py

Okra API wrapper in Python

drawing

===============================

Build Status

Installation

To install with pip

$ pip install okra_py

To install from source, clone this repo:

$ git clone https://github.com/Uchencho/okra_py.git

Change directory into the okra_py folder

$ cd okra_py/

Install the module

$ python setup.py install

Documentation

Please see https://docs.okra.ng/ for the most up-to-date documentation for the OKRA API.

Implementation

Sandbox/Development

By default, the class is instantiated using sandbox(developement) endpoint. To use in production, simply pass the url as an argument to prod_url when instantiating the class.

Okra Auth Class

The okra auth class provides seven methods which corresponds to the okra auth product https://docs.okra.ng/products/auth. Some of the methods are shown below:

  • retrieve_auth: retrieve the bank account and routing numbers associated with a Record's current, savings, and domiciliary accounts,
      # Import the Okra Auth class
      from okra_py.auth import Okra_Auth
    
      # Initialize with a token from okra
      ok_mod = Okra_Auth(my_okra_token)
    
      resp = ok_mod.retrieve_auth()
    
      print(resp.status_code, resp.json())
    
  • getbyID: fetch authentication info using the id.
      the_id = "5rggfdfghjkl4567"
      resp_by_id = ok_mod.getbyID(idx=the_id)
    
      print(resp_by_id.status_code, resp_by_id.json())
    
  • getbyCustomer: fetch authentication info using the customer id.
      customer_id = "5rggfdfghjkl4567"
      resp_by_cus_id = ok_mod.getbyCustomer(customer_id=customer_id)
    
      print(resp_by_cus_id.status_code, resp_by_cus_id.json())
    
  • getbyBank: fetch authentication info using the bank id.
      bank_id = "5rggfdfghjkl4567"
      resp_by_bank_id = ok_mod.getbyBank(bank_id=bank_id)
    
      print(resp_by_bank_id.status_code, resp_by_bank_id.json())
    

Balance Class Example

The okra balance class provides eight methods which corresponds to the okra balance product https://docs.okra.ng/products/balance. Some of the methods are shown below:

  • retrieve_balance: this returns the real-time balance for each of a Record's account
      # Import the Okra Balance class
      from okra_py.balance import Okra_Balance
    
      # Initialize with a token from okra
      ok_bal = Okra_Balance(my_okra_token)
    
      bal_resp = ok_bal.retrieve_balance()
    
      print(bal_resp.status_code, bal_resp.json())
    
  • getbyID: fetch balance info using the id of the balance.
      the_id = "5rggfdfghjkl4567"
      bal_by_id = ok_bal.getbyID(idx=the_id)
    
      print(bal_by_id.status_code, bal_by_id.json())
    
  • getbyAccount: fetch balance info using the account id.
      account_id = "5rggfdfghjkl4567"
      resp_by_account_id = ok_bal.getbyAccount(account_id=account_id)
    
      print(resp_by_account_id.status_code, resp_by_account_id.json())
    

Production

Retrieve Auth Production Example

  • retrieve_auth: retrieve the bank account and routing numbers associated with a Record's current, savings, and domiciliary accounts,
      # Import the Okra Auth class
      from okra_py.auth import Okra_Auth
    
      # Initialize with a token from okra
      prod_okr_mod = Okra_Auth(my_okra_token, prod_url='https://api.okra.ng')
    
      prod_resp = prod_okr_mod.retrieve_auth()
    
      print(prod_resp.status_code, prod_resp.json())
    
  • getbyID: fetch authentication info using the id.
      the_id = "5rggfdfghjkl4567"
      prod_resp_by_id = prod_okr_mod.getbyID(idx=the_id)
    
      print(prod_resp_by_id.status_code, prod_resp_by_id.json())
    

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

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

Source Distribution

okra_py-1.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

okra_py-1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file okra_py-1.1.tar.gz.

File metadata

  • Download URL: okra_py-1.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.5

File hashes

Hashes for okra_py-1.1.tar.gz
Algorithm Hash digest
SHA256 bad17300d21b825bff92e3d1d2dd25d8603104a35b4dff910b306dd72da1caaf
MD5 94d0e7894b32659008a9a647337d4401
BLAKE2b-256 631aa5d6b89cf405ac9aa012d727fda19cac98e4e73b2d248d012b4863eb5c17

See more details on using hashes here.

File details

Details for the file okra_py-1.1-py3-none-any.whl.

File metadata

  • Download URL: okra_py-1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.5

File hashes

Hashes for okra_py-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ab934c175017c17d3496aa73cd98638cd7a06c2e2b3170745b381fb58c30dd3
MD5 764501d0b6eb02666f189e562b294817
BLAKE2b-256 db97c068e881dcf2f29a53ecc3bb9b6094fd2b429a9e6f51803edb8ba4481f24

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