abstra.services
Run actions of services (other projects) this project has access to. See Services.
from abstra.services import (
ServiceActionError,
describe_service_action,
list_service_actions,
list_services,
run_service_action,
)
run_service_action
Runs an action of a service as this project and returns the hook's response body.
result = run_service_action(service_id, action, parameters)
| Name | Description | Type | Default |
|---|---|---|---|
| service_id (required) | The service's project id. | str | |
| action (required) | The action name. | str | |
| parameters | The action's parameters, matching its input schema. | dict | {} |
Returns the hook's response body, parsed as JSON when it is JSON, otherwise the raw text.
Raises ServiceActionError when the call is refused or the hook answers with status 400 or above.
list_services
services = list_services()
Returns the services this project holds a role on, each with id and name.
list_service_actions
actions = list_service_actions(service_id)
Returns the service's actions this project may run, each with name and, when set, title and description.
describe_service_action
action = describe_service_action(service_id, action)
Returns the action's name, title, description, input (JSON Schema of the parameters) and output (JSON Schema of the answer, when declared).
ServiceActionError
| Attribute | Description |
|---|---|
status | The HTTP status: Abstra's, when the call was refused, or the hook's own. |
code | Why Abstra refused the call (see below), or None for the hook's own errors. |
details | The validation errors, the limit that was hit, or the hook's response body. |
Errors
| Status | code | Meaning |
|---|---|---|
| 400 | invalid_parameters | The parameters don't match the action's input schema. details["errors"] lists each error with its path and message. The hook didn't run. |
| 403 | missing_role | This project holds a role on the service, but not one this action requires. |
| 404 | The service or the action doesn't exist, isn't available, or this project can't reach it. | |
| 429 | rate_limited | Too many calls from this project to this service: 120 a minute, or 10 at the same time. details has the limit and, for the per-minute limit, retryAfterSeconds. |
| 508 | call_depth_exceeded | The chain of calls between projects reached 8. |
| 400–599 | None | The hook answered with this status. details is its response body. |
abstra.apps (deprecated)
The module's name before the rename to Services. It still works and prints a deprecation warning on each call:
| Deprecated | Use |
|---|---|
run_app_action(project_id, action, parameters) | run_service_action(service_id, action, parameters) |
list_connected_apps() | list_services() |
list_app_actions(project_id) | list_service_actions(service_id) |
describe_app_action(project_id, action) | describe_service_action(service_id, action) |
AppActionError | ServiceActionError (the same class) |