Skip to main content

Unofficial Treasure Workflow API client

Project description


Unofficial Treasure Workflow API client.


pip install git+


import os

from tdworkflow.client import Client

apikey = os.getenv("TD_API_KEY")
client = Client(site="us", apikey=apikey)
# Or, write endpoint explicitly
# client = Client(endpoint="", apikey=apikey)

projects = client.projects("pandas-df")

secrets = {"td.apikey": apikey, "td.apiserver": "", "test": "secret-foo"}

client.set_secrets(projects[0], secrets)

# ['td.apikey', 'td.apiserver', "test"]
client.delete_secrets(projects[0], ["test", "td.apiserver"])

Uplaod Project from GitHub

Before executing example code, you have to install git-python

pip install gitpython

Clone example repository with git-python and upload a digdag project.

import tempfile
import os
import shutil

import tdworkflow

from git import Git

# Download example GitHub repositoory

tempdir = tempfile.gettempdir()

git_repo = ""

shutil.rmtree(os.path.join(tempdir, "treasure-boxes"))

    print("Clone repository succeeded")
except Exception:
    print("Repository clone failed")

# Upload specific Workflow project

apikey = os.getenv("TD_API_KEY")
site = "us"

target_box = os.path.join("integration-box", "python")
target_path = os.path.join(tempdir, "treasure-boxes", target_box)

client = tdworkflow.client.Client(site=site, apikey=apikey)
project = client.create_project("my-project", target_path)

If you want to open Treasure Workflow console on your browser, you can get the workflow URL as the following:

    "us": "",
    "eu01": "",
    "jp": "",

workflows = client.project_workflows(project)
workflows = list(filter(lambda w: != "test", workflows))
if workflows:
    print(f"Project created! Open {CONSOLE_URL[site]}/{workflows[0].id}/info on your browser and clieck 'New Run' button.")
    print("Project creation failed.")

Start workflow session

You can start workflow session by using Client.start_attempt.

attempt = client.start_attempt(workflows[0])

# Wait attempt until finish. This may require few minutes.
attempt = client.wait_attempt(attempt)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tdworkflow, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size tdworkflow-0.1.0-py3-none-any.whl (12.5 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page