Name | archimedes-python-client JSON |
Version |
4.20.3
JSON |
| download |
home_page | |
Summary | The Python library for Archimedes |
upload_time | 2024-03-19 09:40:46 |
maintainer | |
docs_url | None |
author | Optimeering AS |
requires_python | >=3.9,<3.12 |
license | Apache-2.0 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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](https://docs.python.org/3/library/venv.html) to manage the virtual environment in this example.
### Creating a virtual environment.
```bash
python3 -m venv .venv
```
This will create a directory named `.venv` where all the dependencies will be installed.
### Activating the virtual environment
```bash
source ./.venv/bin/activate # linux/macOS
.venv\Scripts\activate.bat # Windows cmd
.\.venv\Scripts\Activate.ps1 # Windows PowerShell
```
### Installing`archimedes-python-client`
```bash
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`.
```bash
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.
1. `AZURE_AD_TENANT_ID` **Provided by Optimeering AS**
2. `AZURE_AD_APP_ID` **Provided by Optimeering AS**
3. `AZURE_AD_APP_CLIENT_CREDENTIAL` **Provided by Optimeering AS**
4. `USE_APP_AUTHENTICATION` **Set 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.
```python
#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.
Raw data
{
"_id": null,
"home_page": "",
"name": "archimedes-python-client",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<3.12",
"maintainer_email": "",
"keywords": "",
"author": "Optimeering AS",
"author_email": "dev@optimeering.com",
"download_url": "https://files.pythonhosted.org/packages/c8/58/40a514a0a5615dd8a73affb2d71f15165e12e4ddbf7fae3eacaf3244040a/archimedes_python_client-4.20.3.tar.gz",
"platform": null,
"description": "# archimedes-python-client\n\n`archimedes` is the python sdk for accessing Optimeering data. This document outlines the setup of \nenvironment, authentication and general usage of the python client to fetch RK within day data using python.\n\n## Setting up the environment\n\nWe will be using [venv](https://docs.python.org/3/library/venv.html) to manage the virtual environment in this example.\n\n### Creating a virtual environment.\n\n```bash\npython3 -m venv .venv\n```\n\nThis will create a directory named `.venv` where all the dependencies will be installed.\n\n### Activating the virtual environment\n\n```bash\nsource ./.venv/bin/activate # linux/macOS\n.venv\\Scripts\\activate.bat # Windows cmd\n.\\.venv\\Scripts\\Activate.ps1 # Windows PowerShell\n```\n\n### Installing`archimedes-python-client`\n\n```bash\npython3 -m pip install archimedes-python-client\n```\n\n## Authentication\n\n**For local development:**\n\nFor local development, the python client can use user authentication. The users are can be authenticated using the \narchimedes command line tool `arcl`.\n\n```bash\npython3 -m pip install arcl\n\narcl auth login # then, follow the instructions to login with your Microsoft account\n```\n\nOnce the user is logged in, the archimedes login information will be stored in your `~/.archimedes` directory and all \nthe scripts and applications running as the same user are able to authenticate to the API automatically when using the \n`archimedes-python-client`.\n\n**For deployed applications:**\n\nThe python client uses the following fields in environment variable for authentication of the client.\n\n1. `AZURE_AD_TENANT_ID` **Provided by Optimeering AS**\n2. `AZURE_AD_APP_ID` **Provided by Optimeering AS**\n3. `AZURE_AD_APP_CLIENT_CREDENTIAL` **Provided by Optimeering AS**\n4. `USE_APP_AUTHENTICATION` **Set to True**\n\nAs long as these variables have been set up as environment variables, any python script that invokes methods in \n`archimedes` will automatically use the values in the environment variables for authentication.\n\n## Example Code\n\nBelow is a code sample that invokes an `archimedes` method.\n\n```python\n#import os\nimport archimedes\n\n# The following environment variables are only needed for deployed applications.\n# These would ideally be set in the app runtime environment and not necessarily in \n# python code\n# os.environ[\"AZURE_AD_TENANT_ID\"] = \"***azure_ad_tenant_id***\"\n# os.environ[\"AZURE_AD_APP_ID\"] = \"***azure_ad_client_id***\"\n# os.environ[\"AZURE_AD_APP_CLIENT_CREDENTIAL\"] = \"***secret***\"\n# os.environ[\"USE_APP_AUTHENTICATION\"] = \"true\"\n\ndata = archimedes.rk_within_day.directions(\n start=\"2023-01-01 00:00:00+0000\",\n price_area=\"NO1\",\n end=\"2023-01-01 01:00:00+0000\",\n ref_dt=\"2022-12-31 23:00:00+0000\"\n)\nprint(data)\n```\n\nThe sample code prints the RK within day directions probability for provided constraints to the console.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "The Python library for Archimedes",
"version": "4.20.3",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7e969ab4c4287c8afefdc4a782e604a2b56093c50cd63afdcb89f9609f51e97a",
"md5": "275e8858082af0869aee1f2d6ce5c7bd",
"sha256": "09f843a4352e8a01e8a26bd4cfd8bf3da92290aebdb7848bc54e0920b3546247"
},
"downloads": -1,
"filename": "archimedes_python_client-4.20.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "275e8858082af0869aee1f2d6ce5c7bd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<3.12",
"size": 36505,
"upload_time": "2024-03-19T09:40:44",
"upload_time_iso_8601": "2024-03-19T09:40:44.866052Z",
"url": "https://files.pythonhosted.org/packages/7e/96/9ab4c4287c8afefdc4a782e604a2b56093c50cd63afdcb89f9609f51e97a/archimedes_python_client-4.20.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c85840a514a0a5615dd8a73affb2d71f15165e12e4ddbf7fae3eacaf3244040a",
"md5": "8632326e4a8ea181aeaa2ffdbcf19a6c",
"sha256": "80b34e3b1154bb476d9af04e3f8a52788119dd4f3c8bc53ffe90812243a3abc1"
},
"downloads": -1,
"filename": "archimedes_python_client-4.20.3.tar.gz",
"has_sig": false,
"md5_digest": "8632326e4a8ea181aeaa2ffdbcf19a6c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<3.12",
"size": 27336,
"upload_time": "2024-03-19T09:40:46",
"upload_time_iso_8601": "2024-03-19T09:40:46.910357Z",
"url": "https://files.pythonhosted.org/packages/c8/58/40a514a0a5615dd8a73affb2d71f15165e12e4ddbf7fae3eacaf3244040a/archimedes_python_client-4.20.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-19 09:40:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "archimedes-python-client"
}