Skip to main content

Python client library for the AWE (Advanced Workflow Engine) API

Project description

pyawe

Python client library for the AWE (Advanced Workflow Engine) API.

Installation

pip install pyawe

Quick start

from pyawe import AweClient

client = AweClient(
    api_url="http://localhost:8080",
    auth_url="http://localhost:8081",   # ullav-user-management service
)
client.login(email="user@example.com", password="secret")

# Workflows
workflows = client.workflows.list()
wf = client.workflows.create("Q1 Onboarding", is_template=False)
detail = client.workflows.get(wf.id)          # WorkflowWithTasks

# Tasks
task = client.tasks.create("Review docs", workflow_id=wf.id, is_start=True)
client.tasks.update(task.id, status="In Progress")
mine = client.tasks.list_mine()               # tasks assigned to me / my roles

# Jobs
job = client.jobs.create("Q1 Campaign")
client.jobs.clone_workflow(job.id, workflow_template_id)

# Notes
note = client.notes.create("task", task.id, "Looks good", is_shared=True)
client.notes.create_reply(note.id, "Agreed")

# Automated tasks
client.task_scripts.upsert(
    task.id,
    script_type="python",
    script_body="print('hello')",
    timeout_secs=60,
)
runs = client.task_runs.list(task.id)

Example: list your tasks

Print every task assigned to the authenticated user, along with its status and the workflow (and job, if any) it belongs to:

import os
from pyawe import AweClient

client = AweClient(
    api_url=os.environ["AWE_API_URL"],
    auth_url=os.environ.get("AWE_AUTH_URL", os.environ["AWE_API_URL"]),
)
client.login(email=os.environ["AWE_EMAIL"], password=os.environ["AWE_PASSWORD"])

for twc in client.tasks.list_mine():
    context = twc.workflow_name
    if twc.job_name:
        context = f"{twc.job_name} / {twc.workflow_name}"
    print(f"[{twc.task.status}]  {twc.task.name}  ({context})")

A runnable version of this script is at examples/list_my_tasks.py.

Authentication

AweClient authenticates against the ullav-user-management service, which issues the JWT accepted by the AWE server.

  • api_url — AWE server base URL (e.g. http://awe-server:8080)
  • auth_url — auth service base URL (e.g. http://ullav-user-management:8081); omit if both services are behind the same proxy

Call client.login(email, password) before any other method. Tokens expire according to the server's configuration; call login() again to refresh.

Resource clients

Attribute Resource
client.workflows Workflow CRUD, merge, duplicate, team
client.tasks Task CRUD, mine, decide, rework
client.task_links Link create/delete, next/previous tasks, data bindings
client.task_ports Port spec CRUD, input/output values
client.task_scripts Automated task script upsert/delete
client.task_runs Execution run history
client.task_team_roles Team-role assignment
client.jobs Job CRUD, clone workflow, team
client.execution_profiles Kubernetes execution profile CRUD
client.loop_blocks Loop block CRUD
client.notes Note CRUD, replies, folder move
client.note_folders Note folder CRUD

Error handling

from pyawe import AweAuthError, AweNotFoundError, AweValidationError

try:
    wf = client.workflows.get("non-existent-id")
except AweNotFoundError:
    print("not found")
except AweAuthError:
    client.login(email, password)  # token expired — re-authenticate
except AweValidationError as e:
    print("bad request:", e)
Exception HTTP status
AweAuthError 401 / 403, or login() not called
AweNotFoundError 404
AweValidationError 400
AweServerError 5xx
AweError base class

Status values

Use the Status and ScheduleStatus enumerations or plain strings:

from pyawe import Status, ScheduleStatus

client.tasks.update(task_id, status=Status.IN_PROGRESS)
client.tasks.update(task_id, status="In Progress")  # equivalent

Licence

MIT

Project details


Download files

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

Source Distribution

pyawe-0.1.0.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

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

pyawe-0.1.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file pyawe-0.1.0.tar.gz.

File metadata

  • Download URL: pyawe-0.1.0.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pyawe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 81e5bb1d233d530d80fd7e9d614a7d3fab5a88f759e23de7b5c7dd4a3fe4a10c
MD5 a0b1e37390b170081d82ff386a38fb63
BLAKE2b-256 5ef7c75aae63c1709ddd8a42337bcd2d31b7faab0a73bd8bdf8bd8810f00ef01

See more details on using hashes here.

File details

Details for the file pyawe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyawe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pyawe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb27ee86d6e5aa5b2b1230391aa340def3b2f9052d2a09b8363f98078af02358
MD5 0ae5c85221f651798a0c4e5465113baa
BLAKE2b-256 6aef2ea9306af38d986b87f421a8f46b563ef9e6d9d8c5c34cbaf2a7df387704

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page