Metadata-Version: 2.1
Name: dioptra-iris-client
Version: 0.2.1
Summary: Python client for the Iris API.
Home-page: https://github.com/dioptra-io/iris-client
License: MIT
Author: Maxime Mouchet
Author-email: maxime.mouchet@lip6.fr
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: Authlib (>=0.15.5,<0.16.0)
Requires-Dist: httpx (>=0.22.0,<0.23.0)
Description-Content-Type: text/markdown

# 🕸️ Iris Python Client

[![Tests](https://img.shields.io/github/workflow/status/dioptra-io/iris-client/Tests?logo=github)](https://github.com/dioptra-io/iris-client/actions/workflows/tests.yml)
[![Coverage](https://img.shields.io/codecov/c/github/dioptra-io/iris-client?logo=codecov&logoColor=white)](https://app.codecov.io/gh/dioptra-io/iris-client)
[![PyPI](https://img.shields.io/pypi/v/dioptra-iris-client?logo=pypi&logoColor=white)](https://pypi.org/project/dioptra-iris-client/)

Minimal 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

# NOTE: If the username and/or the password are not specified,
# they will be retrieved from the `IRIS_USERNAME` and `IRIS_PASSWORD` environment variables.

# Synchronous client
with IrisClient("user@example.org", "password") as client:
    measurements = client.get("/measurements/").json()

# Asynchronous client
async with AsyncIrisClient("user@example.org", "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/")
```

