Sdks

Python Client Guide

Build secure Python workflows against the Datafuse v1 integration routes.

The Python examples below use requests to call the same routes that power the app. They are easy to drop into notebooks, workers, and backend services.


1. Initialization

python
import os

base_url = os.getenv("DATAFUSE_API_URL", "https://api.datafuse.xyz")
token = os.getenv("DF_TOKEN", "")

headers = {
    "Authorization": f"Bearer {token}",
}

2. Discover Integrations

python
import requests

integrations = requests.get(
    f"{base_url}/api/v1/integrations",
    headers=headers,
).json()

for integration in integrations.get("items", []):
    print(f"{integration['id']}: {integration.get('provider_key')}")

3. Resolve and Invoke

python
integration_id = integrations["items"][0]["id"]

tools = requests.post(
    f"{base_url}/api/v1/integrations/{integration_id}/resolve-tools",
    headers=headers,
).json()

tool_key = tools[0]["slug"]

response = requests.post(
    f"{base_url}/api/v1/integrations/{integration_id}/invoke",
    headers={**headers, "Content-Type": "application/json"},
    json={
        "tool_key": tool_key,
        "arguments": {
            "channel": "#engineering",
            "text": "Deployment is complete and staging is ready for validation."
        },
    },
).json()

print(response["successful"])
print(response["data"])

Next Steps