Client for Leap Workflows API
Project description
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
๐ Back to Table of Contents
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
๐ Back to Table of Contents
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
๐ Back to Table of Contents
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
๐ Back to Table of Contents
Author
This Python package is automatically generated by Konfig
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
Built Distribution
File details
Details for the file leap_workflows_python_sdk-2.0.3.tar.gz
.
File metadata
- Download URL: leap_workflows_python_sdk-2.0.3.tar.gz
- Upload date:
- Size: 58.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff3ff1343cf6b045f13b61e4734f576c7e4ef5d1855485b4b6cca143fa9a08a9 |
|
MD5 | de4927cb75e76a99f29a5d6256de4223 |
|
BLAKE2b-256 | 6aaa1a940636f90935af7319cc3e2e155957ad4725edcf968e8f376c0f6416c1 |
File details
Details for the file leap_workflows_python_sdk-2.0.3-py3-none-any.whl
.
File metadata
- Download URL: leap_workflows_python_sdk-2.0.3-py3-none-any.whl
- Upload date:
- Size: 104.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b80e10044d28694eb91e9b08c08a91f080f67fcb7be458fda85c4f71694c69e5 |
|
MD5 | 8bb064dcb4e8d6b86247ca4042b6b621 |
|
BLAKE2b-256 | 10884711995734b11a2a7d4d52efc092c1fc7d1b5592756684ba09ed54ee2dc8 |