okra_py
Okra API wrapper in Python
===============================
Installation
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, simplly pass the url as an argument to prod_url when instantiating the class.
Retrieve Auth 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 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())
Balance Class Example
-
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())
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())