# 🕸️ Iris Python Client
[](https://github.com/dioptra-io/iris-client/actions/workflows/tests.yml)
[](https://app.codecov.io/gh/dioptra-io/iris-client)
[](https://pypi.org/project/dioptra-iris-client/)
Minimalist Python client for the [Iris](https://github.com/dioptra-io/iris) API,
built on top of [Authlib](https://github.com/lepture/authlib) and [httpx](https://github.com/encode/httpx).
## Installation
```bash
pip install dioptra-iris-client
```
## Usage
```python
from iris_client import IrisClient, AsyncIrisClient
base_url = "https://api.iris.dioptra.io"
username = "user@example.org"
password = "password"
# Synchronous client
with IrisClient(base_url, username, password) as client:
measurements = client.get("/measurements/").json()
# Asynchronous client
async with AsyncIrisClient(base_url, username, password) as client:
measurements = (await client.get("/measurements/")).json()
# Helper function to fetch all the results from a paginated endpoint,
# available for both clients:
all_measurements = client.all("/measurements/")
```
### Credential provider chain
The Iris client looks for credentials in a way similar to the [AWS SDK](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html):
1. If one of `base_url`, `username` or `password` is specified, these values will be used.
2. If none of the previous values are specified, and one of `IRIS_BASE_URL`, `IRIS_USERNAME` or `IRIS_PASSWORD`
environment variables are present, these values will be used.
3. If none of the previous values are specified, and the file `~/.config/iris/credentials.json` exists,
the fields `base_url`, `username` and `password` will be used.
Raw data
{
"_id": null,
"home_page": "https://github.com/dioptra-io/iris-client",
"name": "dioptra-iris-client",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Maxime Mouchet",
"author_email": "maxime.mouchet@lip6.fr",
"download_url": "https://files.pythonhosted.org/packages/e7/fe/222f59e124f2cffda9e9f74f9424a8ca5ae85bd4516fecd3cebcea234917/dioptra_iris_client-0.5.0.tar.gz",
"platform": null,
"description": "# \ud83d\udd78\ufe0f Iris Python Client\n\n[](https://github.com/dioptra-io/iris-client/actions/workflows/tests.yml)\n[](https://app.codecov.io/gh/dioptra-io/iris-client)\n[](https://pypi.org/project/dioptra-iris-client/)\n\nMinimalist Python client for the [Iris](https://github.com/dioptra-io/iris) API,\nbuilt on top of [Authlib](https://github.com/lepture/authlib) and [httpx](https://github.com/encode/httpx).\n\n## Installation\n\n```bash\npip install dioptra-iris-client\n```\n\n## Usage\n\n```python\nfrom iris_client import IrisClient, AsyncIrisClient\n\nbase_url = \"https://api.iris.dioptra.io\"\nusername = \"user@example.org\"\npassword = \"password\"\n\n# Synchronous client\nwith IrisClient(base_url, username, password) as client:\n measurements = client.get(\"/measurements/\").json()\n\n# Asynchronous client\nasync with AsyncIrisClient(base_url, username, password) as client:\n measurements = (await client.get(\"/measurements/\")).json()\n\n# Helper function to fetch all the results from a paginated endpoint,\n# available for both clients:\nall_measurements = client.all(\"/measurements/\")\n```\n\n\n### Credential provider chain\n\nThe Iris client looks for credentials in a way similar to the [AWS SDK](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html):\n\n1. If one of `base_url`, `username` or `password` is specified, these values will be used.\n2. If none of the previous values are specified, and one of `IRIS_BASE_URL`, `IRIS_USERNAME` or `IRIS_PASSWORD`\n environment variables are present, these values will be used.\n3. If none of the previous values are specified, and the file `~/.config/iris/credentials.json` exists,\n the fields `base_url`, `username` and `password` will be used.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python client for the Iris API.",
"version": "0.5.0",
"project_urls": {
"Homepage": "https://github.com/dioptra-io/iris-client"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b5d5a55dc0c6547e2575009958fdd206e7349cdabd2ad60711d736f8de98ed2b",
"md5": "5563834f9b92aa6c4486714e9ecc8d6a",
"sha256": "693d4a917dcd44259d3e136d273032ef68822adde558720ce1003246d8817b0a"
},
"downloads": -1,
"filename": "dioptra_iris_client-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5563834f9b92aa6c4486714e9ecc8d6a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 4838,
"upload_time": "2023-10-26T17:29:07",
"upload_time_iso_8601": "2023-10-26T17:29:07.199252Z",
"url": "https://files.pythonhosted.org/packages/b5/d5/a55dc0c6547e2575009958fdd206e7349cdabd2ad60711d736f8de98ed2b/dioptra_iris_client-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e7fe222f59e124f2cffda9e9f74f9424a8ca5ae85bd4516fecd3cebcea234917",
"md5": "b3069a1b01e315a5772016ec10fbef60",
"sha256": "7cb1230a2a8000fc0d11a13322b03c25902af98be6be7c0c824595c61ce84a1f"
},
"downloads": -1,
"filename": "dioptra_iris_client-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "b3069a1b01e315a5772016ec10fbef60",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 3756,
"upload_time": "2023-10-26T17:29:08",
"upload_time_iso_8601": "2023-10-26T17:29:08.530367Z",
"url": "https://files.pythonhosted.org/packages/e7/fe/222f59e124f2cffda9e9f74f9424a8ca5ae85bd4516fecd3cebcea234917/dioptra_iris_client-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-26 17:29:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dioptra-io",
"github_project": "iris-client",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dioptra-iris-client"
}