Install & Compatibility
Where this runs
tested against v0.4.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.117s · 25.3MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 2.6s · import 0.089s · 26MB
23MB installed
● package 23MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DuploClient
✓ from duplocloud import DuploClient
✗ from duplocloud import DuploClient
This quickstart demonstrates how to initialize the `DuploClient` using environment variables for authentication and then attempts to list tenants. Ensure `DUPLO_HOST`, `DUPLO_TOKEN`, and optionally `DUPLO_TENANT` are set in your environment. The example also shows how to use the `DuploCtl.from_env()` for a CLI-like callable interface to interact with resources.
import os
from duplocloud.client import DuploClient
# Ensure DUPLO_HOST and DUPLO_TOKEN are set in your environment
duplo_host = os.environ.get('DUPLO_HOST', 'https://example.duplocloud.net') # Replace with your DuploCloud portal URL
duplo_token = os.environ.get('DUPLO_TOKEN', '') # Replace with your DuploCloud API token
duplo_tenant = os.environ.get('DUPLO_TENANT', 'default') # Optional: your target tenant
if not duplo_token:
print("Error: DUPLO_TOKEN environment variable not set.")
exit(1)
if not duplo_host:
print("Error: DUPLO_HOST environment variable not set.")
exit(1)
try:
# Initialize the client
client = DuploClient(host=duplo_host, token=duplo_token, tenant_name=duplo_tenant)
print(f"Successfully initialized DuploClient for host: {duplo_host}, tenant: {duplo_tenant}")
# Example: List tenants (assuming the token has appropriate permissions)
# The client often exposes resources as attributes or methods following CLI patterns.
# Direct programmatic access might vary, but a common pattern is to access resource managers.
# For this example, we'll assume a 'tenant' resource is accessible for listing.
# Note: Specific resource methods might require exploration of the DuploClient object.
print("\nAttempting to list tenants...")
try:
# This is an illustrative example. Actual resource access might be via client.get('tenant')
# or client.tenant.list(). Refer to DuploCloud's SDK documentation for exact methods.
# The `duploctl` CLI uses `duplocloud.controller.DuploCtl.from_env()` for a callable interface.
from duplocloud.controller import DuploCtl
duplo_cli_callable, _ = DuploCtl.from_env() # Reads from env vars for convenience
tenants = duplo_cli_callable("tenant", "list")
print("Tenants:")
for tenant in tenants:
print(f" - {tenant.get('Name')} (ID: {tenant.get('TenantId')})")
except Exception as e:
print(f"Could not list tenants (this might be due to permissions or API structure): {e}")
except Exception as e:
print(f"An error occurred during client initialization or operation: {e}")
duploctl --version
Upgrade
Version history
0.4.3latest on PyPI · released Mar 18, 2026
Audit
Dependencies
pythonrequiredRequired for execution