Skip to main content

Python client for the Iris API.

Project description

🕸️ Iris Python Client

Tests Coverage PyPI

Minimalist Python client for the Iris API, built on top of Authlib and httpx.

Installation

pip install dioptra-iris-client

Usage

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:

  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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dioptra_iris_client-0.5.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

dioptra_iris_client-0.5.0-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page