Skip to main content

Client for Leap Workflows API

Project description

Visit Leap Workflows

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.

PyPI README.md More Info

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

BulkRunSchema

๐ŸŒ 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

RunBulkWorkflowSchema

๐Ÿ”„ Return

BulkRunSchema

๐ŸŒ 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

WorkflowRunSchema

๐ŸŒ 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

RunWorkflowSchema

๐Ÿ”„ Return

WorkflowRunSchema

๐ŸŒ 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

leap_workflows_python_sdk-2.0.3.tar.gz (58.4 kB view hashes)

Uploaded Source

Built Distribution

leap_workflows_python_sdk-2.0.3-py3-none-any.whl (104.2 kB view hashes)

Uploaded Python 3

Supported by

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