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_official

To install from source, clone this repo:

$ git clone https://github.com/okraHQ/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())
      
    
  • get_by_id: fetch authentication info using the id.
      
      the_id = "5rggfdfghjkl4567"
      resp_by_id = ok_mod.get_by_id(idx=the_id)
      
      print(resp_by_id.status_code, resp_by_id.json())
      
    
  • get_by_customer: fetch authentication info using the customer id.
      
      customer_id = "5rggfdfghjkl4567"
      resp_by_cus_id = ok_mod.get_by_customer(customer_id=customer_id)
      
      print(resp_by_cus_id.status_code, resp_by_cus_id.json())
      
    
  • get_by_bank: fetch authentication info using the bank id.
      
      bank_id = "5rggfdfghjkl4567"
      resp_by_bank_id = ok_mod.get_by_bank(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())
      
    
  • get_by_id: fetch balance info using the id of the balance.
      
      the_id = "5rggfdfghjkl4567"
      bal_by_id = ok_bal.get_by_id(idx=the_id)
      
      print(bal_by_id.status_code, bal_by_id.json())
      
    
  • get_by_account: fetch balance info using the account id.
      
      account_id = "5rggfdfghjkl4567"
      resp_by_account_id = ok_bal.get_by_account(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())
      
    
  • get_by_id: fetch authentication info using the id.
      
      the_id = "5rggfdfghjkl4567"
      prod_resp_by_id = prod_okr_mod.get_by_id(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_official-1.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

okra_py_official-1.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: okra_py_official-1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.9

File hashes

Hashes for okra_py_official-1.1.tar.gz
Algorithm Hash digest
SHA256 613102e250d29c5448f09981627ad1d7df608ef9f3c54150f808dda325a8adcd
MD5 2998fb183eafdef68152cd9ae028a34b
BLAKE2b-256 3cf81c3556aa50309318a555fc60d49f17c648df87b368504c2756a6b046909d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for okra_py_official-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 adcc1fa64e327ed3285f268f97e982ad8d7232480908ebb5e0a5adf0fe44a1e8
MD5 bc381082b257c2ec8e8fa616d52016f6
BLAKE2b-256 076ff8858ac73b9f4d146e6ebbdabe22de9c64ad500a665581b39f0236372a80

See more details on using hashes here.

Supported by

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