archimedes-python-client
archimedes is the python sdk for accessing Optimeering data. This document outlines the setup of
environment, authentication and general usage of the python client to fetch RK within day data using python.
Setting up the environment
We will be using venv to manage the virtual environment in this example.
Creating a virtual environment.
python3 -m venv .venv
This will create a directory named .venv where all the dependencies will be installed.
Activating the virtual environment
source ./.venv/bin/activate # linux/macOS
.venv\Scripts\activate.bat # Windows cmd
.\.venv\Scripts\Activate.ps1 # Windows PowerShell
Installingarchimedes-python-client
python3 -m pip install archimedes-python-client
Authentication
For local development:
For local development, the python client can use user authentication. The users are can be authenticated using the
archimedes command line tool arcl.
python3 -m pip install arcl
arcl auth login # then, follow the instructions to login with your Microsoft account
Once the user is logged in, the archimedes login information will be stored in your ~/.archimedes directory and all
the scripts and applications running as the same user are able to authenticate to the API automatically when using the
archimedes-python-client.
For deployed applications:
The python client uses the following fields in environment variable for authentication of the client.
AZURE_AD_TENANT_IDProvided by Optimeering ASAZURE_AD_APP_IDProvided by Optimeering ASAZURE_AD_APP_CLIENT_CREDENTIALProvided by Optimeering ASUSE_APP_AUTHENTICATIONSet to True
As long as these variables have been set up as environment variables, any python script that invokes methods in
archimedes will automatically use the values in the environment variables for authentication.
Example Code
Below is a code sample that invokes an archimedes method.
#import os
import archimedes
# The following environment variables are only needed for deployed applications.
# These would ideally be set in the app runtime environment and not necessarily in
# python code
# os.environ["AZURE_AD_TENANT_ID"] = "***azure_ad_tenant_id***"
# os.environ["AZURE_AD_APP_ID"] = "***azure_ad_client_id***"
# os.environ["AZURE_AD_APP_CLIENT_CREDENTIAL"] = "***secret***"
# os.environ["USE_APP_AUTHENTICATION"] = "true"
data = archimedes.rk_within_day.directions(
start="2023-01-01 00:00:00+0000",
price_area="NO1",
end="2023-01-01 01:00:00+0000",
ref_dt="2022-12-31 23:00:00+0000"
)
print(data)
The sample code prints the RK within day directions probability for provided constraints to the console.
Metadata
Release files for archimedes-python-client 4.20.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| archimedes_python_client-4.20.3.tar.gz | 27.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| archimedes_python_client-4.20.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.8 kB
Release files / archimedes_python_client-4.20.3.tar.gz
| Download URL | archimedes_python_client-4.20.3.tar.gz |
|---|---|
| Size | 27.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80b34e3b1154bb476d9af04e3f8a52788119dd4f3c8bc53ffe90812243a3abc1
|
|
BLAKE2b-256 checksum How to use checksums |
c85840a514a0a5615dd8a73affb2d71f15165e12e4ddbf7fae3eacaf3244040a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.10.13 Linux/6.5.0-1016-azure
|
Release files / archimedes_python_client-4.20.3-py3-none-any.whl
| Download URL | archimedes_python_client-4.20.3-py3-none-any.whl |
|---|---|
| Size | 36.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09f843a4352e8a01e8a26bd4cfd8bf3da92290aebdb7848bc54e0920b3546247
|
|
BLAKE2b-256 checksum How to use checksums |
7e969ab4c4287c8afefdc4a782e604a2b56093c50cd63afdcb89f9609f51e97a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.10.13 Linux/6.5.0-1016-azure
|