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 json 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 json 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 json 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"


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": "255082555555",
"amount":  8000,
"currency":"TZS",
"buyer_remarks":"None",
"merchant_remarks":"None",
"no_of_items":  1

}
#path relatiive to base url
orderPath = "/v1/checkout/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.1.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.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: selcom_apigw_client-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 39c452bd57461f502a970dd11fbf8a04e692612be4b2a43610ef748c8abd4b58
MD5 d5603479d2dd42f20037bf76152ceaa1
BLAKE2b-256 4264299d9464f8e5bcb6b1109f17b74837a9cc20d7b4408f5c140c9896569cba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for selcom_apigw_client-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21f87033935f309dee04b06dbd7457ee6aef024a38b53bcc73e5a0d653c602d5
MD5 05c0c3b108b27b6474ed0ecdeedb875e
BLAKE2b-256 1f75ad164c8abf1a62d2ecfe03ae91ce3c8511294db617b5901ee5cc0cb90f67

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