Agilicus Python SDK

1.415.0 · active · verified Fri Apr 17

The Agilicus Python SDK provides a client for interacting with Agilicus APIs, facilitating secure access to protected resources and management operations. It is currently at version 1.415.0 and appears to follow a rapid release cadence based on frequent version bumps on PyPI, often without detailed public release notes.

Common errors

Warnings

Install

Imports

Quickstart

Initializes the Agilicus client and demonstrates listing users and accessing a protected resource. Requires `AGILICUS_CLIENT_ID`, `AGILICUS_CLIENT_SECRET`, and `AGILICUS_ISSUER` environment variables to be set for authentication.

import os
import agilicus

# Ensure AGILICUS_CLIENT_ID, AGILICUS_CLIENT_SECRET, AGILICUS_ISSUER are set as environment variables.
# Example: os.environ['AGILICUS_CLIENT_ID'] = 'your_client_id_here'

# The Agilicus client automatically picks up credentials from environment variables.
# You can also pass them directly to the constructor.
client = agilicus.Agilicus()

try:
    # Example: List users (requires appropriate permissions)
    print("Attempting to list users...")
    users = client.list_users()
    if users:
        print(f"Successfully listed {len(users)} users. First user ID: {users[0].id}")
    else:
        print("No users found or client lacks permissions to list users.")

    # Example: Access a protected resource (replace with your actual resource path)
    print("\nAttempting to access a protected resource...")
    response = client.get_protected_resource("/api/v1/status") # Illustrative endpoint
    response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx)
    print(f"Protected resource accessed successfully: {response.status_code}")
    print(response.json())

except Exception as e:
    print(f"An error occurred: {e}")
    print("Please ensure your Agilicus client is correctly configured with valid credentials and necessary permissions.")

view raw JSON →