Leap Workflows
The Leap Workflows API allows developers to run workflows, fetch workflow runs, and provide other utility functions related to workflow runs. Please use the X-Api-Key for authenticated requests.
Table of Contents
Requirements
Python >=3.7
Installation
pip install leap-workflows-python-sdk==2.0.3
Getting Started
from pprint import pprint
from leap_workflows import Leap, ApiException
leap = Leap(
api_key="YOUR_API_KEY",
)
try:
# Get a bulk workflow run
get_bulk_response = leap.bulk_workflow_runs.get_bulk(
bulk_run_id="bulk_9Nmenl7rxIu2FiSsnqNyTe9G",
)
print(get_bulk_response)
except ApiException as e:
print("Exception when calling BulkWorkflowRunsApi.get_bulk: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
Async
async support is available by prepending a to any method.
import asyncio
from pprint import pprint
from leap_workflows import Leap, ApiException
leap = Leap(
api_key="YOUR_API_KEY",
)
async def main():
try:
# Get a bulk workflow run
get_bulk_response = await leap.bulk_workflow_runs.aget_bulk(
bulk_run_id="bulk_9Nmenl7rxIu2FiSsnqNyTe9G",
)
print(get_bulk_response)
except ApiException as e:
print("Exception when calling BulkWorkflowRunsApi.get_bulk: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
asyncio.run(main())
Raw HTTP Response
To access raw HTTP response values, use the .raw namespace.
from pprint import pprint
from leap_workflows import Leap, ApiException
leap = Leap(
api_key="YOUR_API_KEY",
)
try:
# Get a bulk workflow run
get_bulk_response = leap.bulk_workflow_runs.raw.get_bulk(
bulk_run_id="bulk_9Nmenl7rxIu2FiSsnqNyTe9G",
)
pprint(get_bulk_response.body)
pprint(get_bulk_response.body["id"])
pprint(get_bulk_response.body["version_id"])
pprint(get_bulk_response.body["status"])
pprint(get_bulk_response.body["created_at"])
pprint(get_bulk_response.body["workflow_id"])
pprint(get_bulk_response.body["input_csv_url"])
pprint(get_bulk_response.body["output_csv_url"])
pprint(get_bulk_response.body["error"])
pprint(get_bulk_response.body["row_count"])
pprint(get_bulk_response.headers)
pprint(get_bulk_response.status)
pprint(get_bulk_response.round_trip_time)
except ApiException as e:
print("Exception when calling BulkWorkflowRunsApi.get_bulk: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
Reference
leap.bulk_workflow_runs.get_bulk
This endpoint retrieves the details of a specific bulk workflow run using its bulk_run_id.
🛠️ Usage
get_bulk_response = leap.bulk_workflow_runs.get_bulk(
bulk_run_id="bulk_9Nmenl7rxIu2FiSsnqNyTe9G",
)
⚙️ Parameters
bulk_run_id: str
The ID of the bulk run to retrieve.
🔄 Return
🌐 Endpoint
/v1/runs/bulk/{bulk_run_id} get
leap.bulk_workflow_runs.run_bulk
This endpoint lets the user run a specified workflow with the provided csv in bulk.
🛠️ Usage
run_bulk_response = leap.bulk_workflow_runs.run_bulk(
workflow_id="wkf_i3F5UjpZ2Vg",
input_csv_url="https://myapp.com/input.csv",
webhook_url="https://myapp.com/webhook",
)
⚙️ Parameters
workflow_id: str
The ID of the workflow to be run in bulk.
input_csv_url: str
A CSV file containing the input data for the bulk run. Each row should contain the input data for a single run.
webhook_url: str
The URL to which the bulk run results should be sent to on completion.
⚙️ Request Body
🔄 Return
🌐 Endpoint
/v1/runs/bulk post
leap.workflow_runs.get_workflow_run
This endpoint retrieves the details of a specific workflow run using its workflow_run_id.
🛠️ Usage
get_workflow_run_response = leap.workflow_runs.get_workflow_run(
workflow_run_id="rnp_x3p27VQk6MyJfLe",
)
⚙️ Parameters
workflow_run_id: str
The ID of the workflow run to retrieve.
🔄 Return
🌐 Endpoint
/v1/runs/{workflow_run_id} get
leap.workflow_runs.workflow
This endpoint lets the user run a specified workflow with the provided workflow definition.
🛠️ Usage
workflow_response = leap.workflow_runs.workflow(
workflow_id="wkf_i3F5UjpZ2Vg",
webhook_url="https://myapp.com/webhook",
input={
"first_name": "Sam",
"last_name": "Altman",
},
)
⚙️ Parameters
workflow_id: str
The ID of the workflow to be run.
webhook_url: str
The URL to which the workflow results should be sent to on completion.
input: RunWorkflowSchemaInput
⚙️ Request Body
🔄 Return
🌐 Endpoint
/v1/runs post
Author
This Python package is automatically generated by Konfig
Release files for leap-workflows-python-sdk 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| leap_workflows_python_sdk-2.0.3.tar.gz | 58.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| leap_workflows_python_sdk-2.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 162.6 kB
Release files / leap_workflows_python_sdk-2.0.3.tar.gz
| Download URL | leap_workflows_python_sdk-2.0.3.tar.gz |
|---|---|
| Size | 58.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff3ff1343cf6b045f13b61e4734f576c7e4ef5d1855485b4b6cca143fa9a08a9
|
|
BLAKE2b-256 checksum How to use checksums |
6aaa1a940636f90935af7319cc3e2e155957ad4725edcf968e8f376c0f6416c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / leap_workflows_python_sdk-2.0.3-py3-none-any.whl
| Download URL | leap_workflows_python_sdk-2.0.3-py3-none-any.whl |
|---|---|
| Size | 104.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b80e10044d28694eb91e9b08c08a91f080f67fcb7be458fda85c4f71694c69e5
|
|
BLAKE2b-256 checksum How to use checksums |
10884711995734b11a2a7d4d52efc092c1fc7d1b5592756684ba09ed54ee2dc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|