Skip to main content

UIO generic API wrappers with pluggable auth, retries, and pagination profiles

Project description

UIO API

A Python library for interacting with UIO APIs, featuring built‑in authentication, robust retries, secure token storage, and pagination utilities.

Documentation Map

  • User Guide (usage, configuration, examples): uio_api/README.md
  • Developer Guide (architecture, internals, patterns): uio_api/INTERNAL.md

Features

  • 🔐 Authentication: Interactive login, static tokens, or system accounts
  • ⚡ Retries: Configurable retry strategy with exponential backoff
  • 🛡️ Secure Storage: Keyring or TOML‑based token storage
  • 📄 Pagination: DRF‑style pagination helpers and safeguards

Installation

pip install uio-api

Quick Start

from uio_api import mreg_client
from uio_api.modules.mreg.endpoints import Endpoint

with mreg_client() as m:
    hosts = m.get_all(Endpoint.Hosts)
    print(f"Found {len(hosts)} hosts")

For full usage, configuration, and advanced examples, see uio_api/README.md.

Token helpers

You can store credentials/tokens via the client instances (URLs resolved automatically):

from uio_api import mreg_client, nivlheim_client

# MREG: add system user (uses MREG_URL from config)
with mreg_client() as client:
    client.add_system_user(username="svc", password="secret")

# MREG: add token with knobs (uses MREG_URL from config)
with mreg_client() as client:
    client.add_token(
        username="bob",
        token="abc123",
        scheme="Token",
        timeout=60.0,
        retry_attempts=5,
        page_size=1000,
    )

# Nivlheim: add API key (uses https://nivlheim.uio.no default)
with nivlheim_client() as client:
    client.add_token(
        username="svc",
        token="apikey123",
        scheme="APIKEY",
    )

# Or use explicit URLs
with mreg_client() as client:
    client.add_token(
        username="bob",
        token="abc123",
        url="https://custom.mreg.uio.no"
    )

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

uio_api-0.1.1.tar.gz (82.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uio_api-0.1.1-py3-none-any.whl (106.8 kB view details)

Uploaded Python 3

File details

Details for the file uio_api-0.1.1.tar.gz.

File metadata

  • Download URL: uio_api-0.1.1.tar.gz
  • Upload date:
  • Size: 82.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for uio_api-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1daadf91dab309341a542c543d19a0ecc5e90e0ea66b772807e7232798958b8f
MD5 c5882d741106360dc7a10311a110c2af
BLAKE2b-256 f3c2e292e2c21b644873e946311678551aed319c23d4bfaca1a20dc8bcddeb89

See more details on using hashes here.

File details

Details for the file uio_api-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: uio_api-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 106.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for uio_api-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 04bb403b88cc3f1dffdb34967747848e03453ce1d2a02d99f7838e865a199128
MD5 d17d063914bb316bc1d98bdc58187317
BLAKE2b-256 5ffe6b8c91115abcc32354dbb6e2baaa0de0a311a7bae263e0e85886fd609f3b

See more details on using hashes here.

Supported by

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