AweClient¶
The top-level client. Instantiate once, call login(), then access resources through the sub-client attributes.
pyawe.AweClient
¶
Client for the AWE (Advanced Workflow Engine) REST API.
Authentication is handled by the ullav-user-management service
(separate from the AWE server). Call :meth:login before making any
API requests; a :exc:~pyawe.exceptions.AweAuthError will be raised
otherwise.
The JWT is stored in the session and attached to every subsequent
request automatically. Tokens expire according to the server's
configuration; call :meth:login again to refresh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_url
|
str
|
Base URL of the AWE server, e.g. |
required |
auth_url
|
Optional[str]
|
Base URL of the authentication service. When auth and AWE share
the same DNS record / reverse-proxy host, omit this argument and
|
None
|
Example
.. code-block:: python
from pyawe import AweClient
# Production: single DNS record, auth served at the same origin
client = AweClient("https://awe.example.com")
client.login(email="user@example.com", password="secret")
# Development: separate ports for AWE and auth services
client = AweClient(
api_url="http://localhost:8080",
auth_url="http://localhost:8081",
)
client.login(email="user@example.com", password="secret")
# Workflows
wfs = client.workflows.list()
wf = client.workflows.create("My Workflow")
# Tasks
task = client.tasks.create("Review", workflow_id=wf.id)
client.tasks.update(task.id, status="In Progress")
# Jobs
job = client.jobs.create("Q1 Campaign")
login
¶
Authenticate and store the JWT for subsequent requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
User email address. |
required |
password
|
str
|
User password. |
required |
Returns:
| Type | Description |
|---|---|
LoginInfo
|
class: |
LoginInfo
|
details, roles, and permissions. |
Raises:
| Type | Description |
|---|---|
AweAuthError
|
If the credentials are invalid. |