4logik python rest client
Utility package to call an enpoint generated by 4Logik
Installation
Use pip
pip install 4logik-python-rest-client
How to call a CSV endpoint
- Locate the input CSV file
- Identify the URL of the enpoint
- Identify the name of the data set of the response that contains the results
Example of using the package:
from py4logik_python_rest_client.endpoint_caller import call_csv_endpoint, call_csv_endpoint_read_data_set
# input parameters
input_csv_file = "/home/user1/incomingData.csv"
endpoint_url = "http://myOrganization.myDeployedService.com/RiskCalulationProcess"
# call the endpoint
received_json_data = call_csv_endpoint(ms_url, input_csv_file)
print(received_json_data)
The result will contain useful metadata like the quantity of business exceptions and the list of data sets which you can print using:
print(received_json_data["data_sets_names"])
print(received_json_data["data_sets_results"])
To read the specific rows of a data set, call the method "call_csv_endpoint_read_data_set" sending the name of the data set, like this:
specific_data_set_name_to_read = "ReportResult"
data_set_result_rows = call_csv_endpoint_read_data_set(ms_url, input_csv_file, specific_data_set_name_to_read)
print(data_set_result_rows)
Example using the package inside Jupyter and converting the result to a data frame:
import json
import pandas as pd
import tempfile
from py4logik_python_rest_client.endpoint_caller import call_csv_endpoint_read_data_set
# input parameters
input_csv_file = "/home/user1/incomingData.csv"
endpoint_url = "http://myOrganization.myDeployedService.com/RiskCalulationProcess"
dataset_name = "riskResult"
# call the endpoint
received_json_data = call_csv_endpoint_read_data_set(ms_url, input_csv_file, dataset_name)
# now convert the received json to panda
temp_file = tempfile.NamedTemporaryFile(delete=False)
output_json = temp_file.name
with open(output_json,'w', encoding='UTF_8') as f:
f.write(json.dumps(received_json_data))
f.close()
final_data_frame = pd.read_json(output_json)
final_data_frame
Metadata
Release files for 4logik-python-rest-client 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| 4logik-python-rest-client-1.0.4.tar.gz | 4.0 kB | Without provenance | Details for 4logik-python-rest-client-1.0.4.tar.gz |
Release files / 4logik-python-rest-client-1.0.4.tar.gz
| Download URL | 4logik-python-rest-client-1.0.4.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bcd136a8d509e30f7bd830d56124513403fab78a9120a615b98fadf2eb9ef537
|
|
BLAKE2b-256 checksum How to use checksums |
9e53f4685d5e8d52a0d9895f159ff3e021a25cc30b8d3fb884904857358c1e33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
|
Security for 4logik-python-rest-client 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.