Skip to main content

Authdog Python SDK

Python SDK for Authdog authentication and user management.

Installation

pip install authdog

Usage

Basic Usage

from authdog import AuthdogClient

# Initialize the client
client = AuthdogClient(
    base_url="https://api.authdog.com",
    api_key="your-api-key"  # Optional
)

# Get user information
try:
    user_info = client.get_userinfo("your-access-token")
    print(f"User: {user_info.user.display_name}")
    print(f"Email: {user_info.user.emails[0].value}")
except AuthenticationError as e:
    print(f"Authentication failed: {e}")
except APIError as e:
    print(f"API error: {e}")

# Always close the client when done
client.close()

Using Context Manager

from authdog import AuthdogClient

with AuthdogClient("https://api.authdog.com") as client:
    user_info = client.get_userinfo("your-access-token")
    print(f"User: {user_info.user.display_name}")

API Reference

AuthdogClient

__init__(base_url: str, api_key: Optional[str] = None, timeout: float = 10.0)

Initialize the Authdog client.

  • base_url: The base URL of the Authdog API
  • api_key: Optional management Bearer credential (userinfo still uses the access token)
  • timeout: Request timeout in seconds (default 10)

health() -> Probe

GET /v1/health. Public; works without an API key.

Management namespaces

organizations, tenants, projects, environments, users, groups, rbac, audit, events, webhooks, notification_channels, service_accounts, personal_access_tokens, and api_secrets wrap Waves 1–2 of the public API. Example:

with AuthdogClient("https://api.authdog.com", api_key="ad_...") as client:
    orgs = client.organizations.list()
    users = client.users.list("ten_123", "env_456")

See specs/004-api-parity/ for the full catalog.

get_userinfo(access_token: str) -> UserInfoResponse

Get user information using an access token.

  • access_token: The access token for authentication
  • Returns: UserInfoResponse (meta, session, user) with snake_case attributes (user.display_name, user.emails[0].value, session.remaining_seconds)

Exceptions

  • AuthdogError: Base exception for all Authdog SDK errors
  • AuthenticationError: Raised when authentication fails (401 responses)
  • APIError: Raised when API requests fail

Development

# Install development dependencies
uv sync

# Run tests
uv run pytest

# Format code
uv run black authdog/
uv run isort authdog/

# Type checking
uv run mypy authdog/

Download files

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

Source Distribution

authdog-0.1.1.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

authdog-0.1.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: authdog-0.1.1.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for authdog-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7c7283886421b3e45d86228bd18f965063ea93aee0d1e5f51d1f44a1be5d8638
MD5 8cd23b34cbe020585f2d25d8f19ebfc7
BLAKE2b-256 69ca75e922b43bec42fd87a4106529247e35feaeec8c19e91328cb82ecd57d40

See more details on using hashes here.

File details

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

File metadata

  • Download URL: authdog-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for authdog-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7dd94e15fa81ab43462fff4bc2882f3d5c69c363d26f53fbab903cbea08e6923
MD5 da17c57438833689113a01b45a17d1b4
BLAKE2b-256 3a027bb631e3c8055c28261ad00b19c2211f1029a7209c648bf6c2d0a1801502

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page