Skip to main content

UnifyPort Python SDK

English | 简体中文 | Website

Type-safe sync and async Python clients for the public UnifyPort Device API. The SDK is generated from the approved public OpenAPI contract and currently tracks @unifyport/sdk-node v0.4.0: 64 operations, 70 component schemas, and the same retry and secret-handling classifications.

The Python package is unifyport-sdk; the import package is unifyport. This repository starts at SDK version 0.1.0. A Git tag or local build alone does not prove that a version reached PyPI.

Requirements

  • Python >=3.11
  • httpx >=0.27,<1
  • typing-extensions >=4.13,<5 for the Python 3.11-3.13 PEP 728 backport

Install the published package from PyPI:

python -m pip install unifyport-sdk

To work from a source checkout:

python -m pip install -e ".[dev]"

Quick start

import os

from unifyport import UnifyPortDeviceClient


def required_env(name: str) -> str:
    value = os.environ.get(name)
    if not value:
        raise RuntimeError(f"Missing required environment variable: {name}")
    return value


with UnifyPortDeviceClient(
    base_url=required_env("UNIFYPORT_DEVICE_API_BASE_URL"),
    api_key=required_env("UNIFYPORT_DEVICE_API_KEY"),
) as device:
    workspace = device.get_workspace()
    print(workspace.data)

The async client exposes the same generated snake_case operation surface:

import os

from unifyport import AsyncUnifyPortDeviceClient


async def main() -> None:
    async with AsyncUnifyPortDeviceClient(
        base_url=os.environ["UNIFYPORT_DEVICE_API_BASE_URL"],
        api_key=os.environ["UNIFYPORT_DEVICE_API_KEY"],
    ) as device:
        workspace = await device.get_workspace()
        print(workspace.data)

Generated operation methods expose path, query, and the allowlisted x_request_id header as typed keyword arguments, plus typed body= and options= when applicable. Authentication is never an operation argument:

account = device.get_account(account_id="acc_example", x_request_id="req_example")

Every call returns ApiResult[data] with only filtered metadata: data, status, and optional request_id. Raw httpx.Response objects are intentionally not public.

Safety boundaries

  • X-Api-Key comes only from client configuration and is resolved once per logical operation.
  • HTTPS is required by default. Explicitly enabled plaintext HTTP remains limited to loopback hosts.
  • Redirects are not followed, and credential-bearing requests cannot escape the configured origin or base path.
  • Automatic retry is restricted to the 19 reviewed operations and the statuses 408, 429, 502, 503, and 504, plus transport failures. Per-call settings can only tighten the global budget.
  • Requests require identity encoding; compressed responses are rejected before raw bodies are streamed through the byte limit and parsed as JSON.
  • Public errors retain stable status, error code, operation ID, and request ID only; raw response text, query strings, credentials, and underlying exception text are not exposed.
  • Cursor helpers enforce a finite page limit and reject missing or repeated cursors.
  • provider_profile and reply_token are sensitive outputs. Do not log complete account or message responses.

The package does not expose MCP tools, Agent Skills, a generic raw-request escape hatch, provider-specific orchestration, or an inferred webhook-signature algorithm.

Contract and generated code

contracts/device.openapi.yaml is the only protocol source for generation. The language-neutral policy file records semantics that cannot be inferred safely from HTTP methods. Do not edit src/unifyport/_generated/ or generated API reference pages directly.

python scripts/generate.py
python scripts/generate.py --check
python scripts/check_node_parity.py --node-repo ../unifyport-sdk-node --node-ref v0.4.0

See the API coverage report, architecture, security boundaries, contract maintenance guide, acceptance report, and release notes.

Validation

ruff format --check .
ruff check .
mypy --strict src scripts typing_tests
npx --yes pyright@1.1.411 pyright_tests
pytest
python -m build
twine check dist/*
python scripts/check_public.py dist/*
python scripts/smoke_installed.py
pip-audit

License

The SDK source is available under the MIT License. The Device API contract describes the service interface and retains its own license metadata.

Metadata

Release files for unifyport-sdk 0.1.0

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

Source distribution (sdist)

Source distribution for unifyport-sdk 0.1.0
File Size Uploaded Provenance
unifyport_sdk-0.1.0.tar.gz 117.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for unifyport-sdk 0.1.0
File Interpreter ABI Platform
unifyport_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 165.4 kB

Release files / unifyport_sdk-0.1.0.tar.gz

Download URL unifyport_sdk-0.1.0.tar.gz
Size 117.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6a94ad9ee5bf7e5c45067cbcee96d0d192497f4b936cd72f648042dd55cc6abb
BLAKE2b-256 checksum
How to use checksums
01b280fbe420c05376ac5f741f522fb69367f74500747c48fe63b6c6f390bc05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / unifyport_sdk-0.1.0-py3-none-any.whl

Download URL unifyport_sdk-0.1.0-py3-none-any.whl
Size 47.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e6c9dbbc761a0e3ff2a126a385cf0641ab21afd86ec1232657d33c495ca5d20
BLAKE2b-256 checksum
How to use checksums
b941f9028380f7dba7172198091ff023cd81cfe98b1f5fbb8424238c5b679ac7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Security for unifyport-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for unifyport_sdk-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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