Skip to main content

Dcipher Workflows API Python library

The Dcipher Workflows Python library provides convenient access to the Dcipher Workflows API from any Python 3.7+ application. It offers both synchronous and asynchronous clients powered by httpx.

Documentation

The REST API documentation can be found on app.dcipheranalytics.com/workflows

Installation

pip install dcipher

Usage

import os
from dcipher import Dcipher

client = Dcipher(
    # This is the default and can be omitted
    api_key=os.environ.get("DCIPHER_API_KEY"),
)

client.run_flow(
    flow_id="65cf2f3e..",
    params={"param1": "...", "param2": "...."}, # param names are set by workflow user
    save_path="output.json",
)

While you can provide an api_key keyword argument, we recommend using python-dotenv to add DCIPHER_API_KEY="my-dcipher-api-key" to your .env file so that your API Key is not stored in source control.

Async usage

Simply import AsyncDcipher instead of Dcipher and use await with each API call:

import os
import asyncio
from dcipher import AsyncDcipher

client = AsyncDcipher(
    # This is the default and can be omitted
    api_key=os.environ.get("DCIPHER_API_KEY"),
)


async def main() -> None:
    await client.run_flow(
        flow_id="65cf2f3e..",
        params={"param1": "...", "param2": "...."}, # param names are set by workflow user
        save_path="output.json",
    )


asyncio.run(main())

Functionality between the synchronous and asynchronous clients is otherwise identical.

Handling errors

When the API returns a non-success status code (that is, 4xx or 5xx response), a subclass of APIStatusError is raised, containing an error message.

In case Timeout or Connection errors occur, the client auto-retries with exponential back-off using tenacity.

Error codes are as follows:

Status Code Error Type
400 BadRequestError
401 AuthenticationError
403 PermissionDeniedError
404 NotFoundError
422 UnprocessableEntityError
429 RateLimitError
>=500 InternalServerError

Retries

Certain errors are automatically retried by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors are all retried by default.

You can use the max_retries option to configure or disable retry settings.

Advanced

Logging

We use the standard library logging module.

You can enable logging by setting the environment variable DCIPHER_LOG to debug.

$ export DCIPHER_LOG=debug

Requirements

Python 3.7 or higher.

Release files for dcipher 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dcipher 0.3.5
File Size Uploaded
dcipher-0.3.5.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dcipher 0.3.5
File Interpreter ABI Platform
dcipher-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / dcipher-0.3.5.tar.gz

Download URL dcipher-0.3.5.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5bf252475e08ecb5f24f24ca164ad4a3615fc2246c072bce0d41b14f637d4c4e
BLAKE2b-256 checksum
How to use checksums
62c13b90204770b0211d87cc5d28dd2e8e36be6ba46998ccddeef39a5813e07e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.11.8 Darwin/24.5.0

Release files / dcipher-0.3.5-py3-none-any.whl

Download URL dcipher-0.3.5-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7ff73d1cec14e07c5b672d88f3af0b49403cf6b2b3c2fc8aeccf79d69a9f8eb
BLAKE2b-256 checksum
How to use checksums
c11694beca9b26f8a60cac6ccf862beaf7eaa4a78c8e8f0816f29382d528f720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.11.8 Darwin/24.5.0

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page