Skip to main content

A small example package

Project description

SELCOM API ACCESS CLIENT

Homepage

https://developers.selcommobile.com/

Description

This is a library containing functions that aid in the accessing of selcom api. IT is made up pf 4 functions.

Installation

pip install selcom_apigw_client

Use

# import apigwClient module
from selcom_apigw_client import apigwClient

# initalize a new CLient instace with values of the base url, api key and api secret
client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#computeHeader  a dictionary/json containing data to bes submitted
#computeHeader returns a tuple with values for the following header fields: 
# Authorization, Timestamp, Digest, Signed-Fields
client.computeHeader( dictData)

#postFuct takes relative path to base url and dictionary containing data to be submitted 
#It performs a POST request of the submitted data to the destniation url generatingg the header internally
#IT returns a String containing the response to the request
client.postFunc(path, dictData)

#ggetFuct takestakes relative path to base url and dictionary containing data to be submitted 
#It performs a GET request adding the query to the  url and generatingg the header internally
#IT returns a String containing the response to the request
client.getFunc(path, dictData)

#deletetFuct takestakes relative path to base url and dictionarycontaining data of wuery 
#It performs a DELETE request adding the query to the  url and generatingg the header internally
#IT returns a String containing the response to the request
client.deleteFunc(path, dictData)

Example

#import package
from selcom_apigw_client import apigwClient
# initalize a new apiAccess instace with values of the base url, api key and api secret

apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com/v1/checkout/"


client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#order data
orderDict = {
"vendor":"VENDORTILL",
"order_id":"1218d5Qb",
"buyer_email": "john@example.com",
"buyer_name": "John Joh",
"buyer_phone": "255682555555",
"amount":  8000,
"currency":"TZS",
"buyer_remarks":"None",
"merchant_remarks":"None",
"no_of_items":  1

}
#path relatiive to base url
orderPath = "create-order-minimal"
#crate new order

response = client.postFunc(orderPath, orderDict)

#get response data
print(response)

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

selcom_apigw_client-1.0.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

selcom_apigw_client-1.0.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file selcom_apigw_client-1.0.0.tar.gz.

File metadata

  • Download URL: selcom_apigw_client-1.0.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for selcom_apigw_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a620e67702b30df8c2206957330e4e5f91f668e18f869eb3f0576d3328e43ab8
MD5 25217bafcdbb8881e219c513b04cbd3d
BLAKE2b-256 a44060764ffe34679fff4a876d49b46422e55d860a7706a66db9e44e5b65b0c7

See more details on using hashes here.

File details

Details for the file selcom_apigw_client-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for selcom_apigw_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0010ae5f36c9ffef70519dbf2b2986d19e8944e4c81dd9ba658968cbd76e235
MD5 4adf4d79255bc232b80d295064a2bfff
BLAKE2b-256 569028a7e47f2e20a52a0c7ca714ec0ee1a8b11ae6600be869fcf5ffce829e1e

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