To install UQO simply do:
pip install uqo
To be able to connect to the UQO servers, you have to create a config object. There are two possibilities to do so:
1. Generate private/public keys
import os
from uqo.generate_certificates import generate_certificates generate_certificates(os.path.dirname(os.path.realpath(__file__)))
This will generate 3 folders („certificates“, „private_keys“ and „public_keys“) in your current working directory. The „certificates“ folder is used as a temporary directory and should be empty after the process completed. You can safely delete this folder.
2. Create the config object directly in the code:
ip = "SERVER_IP:SERVER_PORT"
token = "YOUR_TOKEN"
private_key_file = "PATH_TO_YOUR_PRIVATE_KEY_FILE"
config = Config(method="token", credentials=token, endpoint=ip, configpath=private_key_file)
Replace „PATH_TO_YOUR_PRIVATE_KEY_FILE“ with the actual path to the clien.key_secret file you generated in step 1.
3. Use a config file
Create a config.json with the following structure:
{
"method": "token",
"endpoint": "SERVER_IP:SERVER_PORT",
"credentials": "YOUR_TOKEN",
"private_key_file": "PATH_TO_YOUR_PRIVATE_KEY_FILE"
}
Replace "PATH_TO_YOUR_PRIVATE_KEY_FILE" with the actual path to the clien.key_secret file you generated in step 1.
You can then use this config file as follows:
from uqoclient.client.config import Config
config = Config(config_path="Pathtotheconfigfile")
In the examples above please replace SERVER_IP and SERVER_PORT with the ip and port of the UQO server. Also replace YOUR_TOKEN with your personal UQO token.