A Python library for supporting GovESB Integration
Project description
GovESB Python Package
Sample to Receive Data from GovESB
import requests
from govesb.esb import (
DataFormatEnum, ESBHelper
)
destination_scheme = "https"
destination_host = "jsonplaceholder.typicode.com"
destination_port = "443"
destination_path = "posts"
destination_username = "system-username"
destination_password = "password"
destination_url = f"{destination_scheme}://{destination_host}:{destination_port}/{destination_path}"
# govesb_public_key = ""
govesb_public_key = "+"
system_private_key = ""
sample_data = '''
{"data":{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
},"signature":"MEUCIQDxN3MiBmeO1g2zD3M2Ncw3wQDe2R"}'''
responseData = ESBHelper.verify_and_extract_data(sample_data, DataFormatEnum.JSON, govesb_public_key)
if responseData.has_data and responseData is None:
print("Signature Verification Failed")
# body = ESBHelper2.create_response("{}", DataFormatEnum.JSON, system_private_key, False, "Signature Verification Failed")
else:
print("sample payload", responseData.verified_data)
response = requests.post(url=destination_url, data=responseData.verified_data, auth=(destination_username, destination_password))
Sample to Send Data to GovESB
from govesb.esb import (
DataFormatEnum, ESBHelper
)
destination_scheme = "https"
destination_host = "jsonplaceholder.typicode.com"
destination_port = "443"
destination_path = "posts"
client_id = "client_id"
client_secret = "client_secret"
api_code = "api_code"
signing_key = "signing_key"
esb_token_url = "esb_token_url"
esb_request_url = "esb_request_url"
destination_url = f"{destination_scheme}://{destination_host}:{destination_port}/{destination_path}"
sample_data = {
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et starchitecto"
}
encryptedDataResponse = ESBHelper.esb_request(
client_id=client_id,
client_secret=client_secret,
api_code=api_code,
esb_body=sample_data,
format=DataFormatEnum.JSON,
key=signing_key,
esb_token_url=esb_token_url,
esb_request_url=esb_request_url,
)
print('encryptedDataResponse', encryptedDataResponse)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
govesb-0.1.4.tar.gz
(11.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
govesb-0.1.4-py3-none-any.whl
(15.4 kB
view details)
File details
Details for the file govesb-0.1.4.tar.gz.
File metadata
- Download URL: govesb-0.1.4.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
653d98bb0c375034c9980f4eb5254ae827e07d932e07c6aea22ebe73c90376e0
|
|
| MD5 |
edde2d28f473abd5ddbbc1837ed270bf
|
|
| BLAKE2b-256 |
44c864152770ff4a91ecb007cea8839f254bc153574b601474b12ac593a9b23c
|
File details
Details for the file govesb-0.1.4-py3-none-any.whl.
File metadata
- Download URL: govesb-0.1.4-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8da7fb899c393cb609168b3bcbe9b947e2e601182be4afd2c1403f565671da45
|
|
| MD5 |
6e08b953275be1d96d2bde3f0c777d83
|
|
| BLAKE2b-256 |
c851e8de0219853fb84363d176cf1964a644812aff81f79f4cf58d0652f26fbf
|