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.2
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
Metadata
Release files for leap-workflows-python-sdk 2.0.2
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.2.tar.gz | 58.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| leap_workflows_python_sdk-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 162.3 kB
Release files / leap_workflows_python_sdk-2.0.2.tar.gz
| Download URL | leap_workflows_python_sdk-2.0.2.tar.gz |
|---|---|
| Size | 58.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
671fa9f4765d8722cba9e417c14d5e27b994c80adf00aa387454be080f36c141
|
|
BLAKE2b-256 checksum How to use checksums |
5db4fcbb98d6a5bfd5f84058cd979999bb1303741014a114ddc34e900e5446b3
|
| 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.2-py3-none-any.whl
| Download URL | leap_workflows_python_sdk-2.0.2-py3-none-any.whl |
|---|---|
| Size | 104.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf4f21c900f5da588366a525a191cc7b39c7169629efa97a07c6d31e92a542d7
|
|
BLAKE2b-256 checksum How to use checksums |
d7796096fbc975c21d0861fff795613b270f54ecc0fd6e5075fe6674880b95ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|