Taskcluster URLs

13.0.2 · active · verified Sun Apr 12

Taskcluster-urls is a Python library that provides a standardized way to generate URLs for various Taskcluster resources, such as tasks, artifacts, and releases. It helps integrate with the Taskcluster ecosystem by providing a consistent API for URL construction. As of version 13.0.2, it's actively maintained, with releases often tied to a monorepo that includes JavaScript and Go implementations, so not all version bumps directly imply Python-specific changes.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize `TaskclusterUrls` with a root URL and generate common Taskcluster resource URLs like tasks, artifacts, and release-specific links. It uses an environment variable for the root URL for flexibility.

import os
from taskcluster_urls import TaskclusterUrls

# Replace with your Taskcluster root URL or set as an environment variable
root_url = os.environ.get('TASKCLUSTER_ROOT_URL', 'https://taskcluster.net')

try:
    urls = TaskclusterUrls(root_url)

    # Example 1: Get a URL for a specific task in the queue
    task_id = 'my-task-id'
    run_id = 'my-run-id'
    queue_task_url = urls.queue.task(task_id, run_id)
    print(f"Queue Task URL: {queue_task_url}")

    # Example 2: Get a URL for a specific artifact of a task
    artifact_path = 'public/logs/live_logs.txt'
    artifact_url = urls.queue.artifact(task_id, run_id, artifact_path)
    print(f"Artifact URL: {artifact_url}")

    # Example 3: Get a URL related to a release
    release_id = 'my-release-id'
    release_task_url = urls.release(release_id).task(task_id, run_id)
    print(f"Release Task URL: {release_task_url}")

except ValueError as e:
    print(f"Error initializing TaskclusterUrls: {e}")

view raw JSON →