Admin Auth — Python SDK
Admin-scope authentication and the currently-logged-in admin's identity.
Overview
AdminClient is a separate client for admin-scope operations (billing read + customer CRUD). It authenticates with an admin username and password (no captcha, no API key) and issues a session token scoped to admin-only endpoints. Use WltClient for tenant-user operations and AdminClient when the caller must act as an administrator.
The Auth resource exposes a single endpoint returning the currently logged-in admin's profile, including the admin's user type (e.g. partner_admin) and tenant context.
Accessed via admin.auth.
Available Operations
| Method | Description |
|---|---|
info() | Get the current logged-in admin's information |
Client construction
Instantiate AdminClient with the admin's username and password. The SDK exchanges them for a short-lived session token on the first request and refreshes it transparently on expiry.
from wlt import AdminClient
admin = AdminClient(
username="admin",
password="your-admin-password",
base_url="https://console.example.com",
timeout=30.0,
max_retries=2,
)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| username | str | Yes | -- | Admin username |
| password | str | Yes | -- | Admin password (no captcha) |
| base_url | str | No | Built-in default | Console base URL. See resolution rules on the Overview page. |
| timeout | float | No | 30.0 | Request timeout in seconds |
| max_retries | int | No | 2 | Max retry attempts |
info
Get the current logged-in admin's full profile.
Example Usage
from wlt import AdminClient
admin = AdminClient(username="admin", password="your-admin-password",
base_url="https://console.example.com")
info = admin.auth.info()
print(f"userId={info['userId']} userName={info['userName']} userType={info['userType']}")
Parameters
None.
Response
Returns a dict with the admin's profile. Key fields:
| Field | Type | Description |
|---|---|---|
userId | int | Admin user ID |
userName | str | Admin username |
userType | str | Admin type (e.g. partner_admin, sys_admin) |
accountStructure | int | Account structure code |
partnerId | int | Tenant ID this admin belongs to |
partnerName | str | Tenant name |
parentUserId | int | Parent user ID |
timezone | str | Timezone (e.g. Europe/Paris) |
region | str | Region (e.g. ap-southeast-1) |
userPermission | dict | Admin permission metadata |
Admin resources return raw
dictpayloads directly (not theBaseResponsewrapper used by tenant-user resources). Read fields withinfo["field"].
Errors
| Code | Exception | When |
|---|---|---|
500 | AuthenticationError | Username or password incorrect |
2007 | PermissionError | Not an admin account |
3001 | AuthenticationError | Session expired and refresh failed |
3002 | AuthenticationError | Login attempts rate-limited (retry after 15-60 s) |