Python agent for protopia
Project description
Python Protopia Agent
This is a Python implementation of the Protopia Agent.
Install via Pypi
pip install protopia
Usage via Pypi
import protopia
client = protopia.Agent()
client.get_option()
# returns will be
# > PROTOPIA_CLOUD_URL is set to api.stage-01.stage.protopia.ai:443
# > TOKEN_URL is set to https://protopia-cloud-stage-01.auth.us-east-1.amazoncognito.com/oauth2/token
# > SCOPES is set to ['https://api.stage-01.protopia.ai/noise:read']
# > OIDC_CLIENT_ID is set to None
# > OIDC_CLIENT_SECRET is set to None
client.set_client(client_id, client_secret)
# returns will be (See below to retrieve client_id and client_secret)
# > OIDC_CLIENT_ID is set to client_id
# > OIDC_CLIENT_SECRET is set to client_secret
client.connect()
# returns will be
# > successfully connected to staging cloud API
dist = client.get_noise_distribution(nnid)
# returns will be encrypted noise distribution
Prerequisites
Install the following programs:
- Python version 3.9+
- Run
pip3 install -r requirements.txt protoc- In MacOS this can be installed by running
brew install protoc
- In MacOS this can be installed by running
Running the agent
The following environment variables must be exported prior to running the agent:
OIDC_CLIENT_IDthe client ID of the agent issued by Cognito.OIDC_CLIENT_SECRETthe client secret of the agent issued by Cognito.
A demo agent is created with credentials uploaded to LastPass. Access is granted to hadi@protopia.ai. The credentials can be retrieved from AWS console / Conginto.
Once the above environment variables are exposed, the agent can be run by running the following command:
python3 agent.py
Generting Python From ProtocolBuffer
A script is provided to generate Python code from the ProtocolBuffer defintion of the gRPC protocol exposed by Protopia Cloud. To re-generate Python code from the ProtocolBuffer definition, run:
make protoc
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 Distributions
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
File details
Details for the file protopia-0.1.0-py3-none-any.whl.
File metadata
- Download URL: protopia-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2485a32f7d0fda3a2c989c0b25912cfb0133185b2cef13c5381e93c61717113c
|
|
| MD5 |
f95d318c1e00ecd443ff5db8fa15df09
|
|
| BLAKE2b-256 |
ed9f0fd9d24a61eaf1cff530e95b2878efc42ebb0dcc88fc2e5a435e2f1e6565
|