opensincera-python
Unofficial Python client, CLI, and MCP server for The Trade Desk's OpenSincera advertising-metadata API. Not affiliated with The Trade Desk.
Status
Early development. v0.1.0 ships a sync library + CLI; v0.2.0 adds an MCP server; v0.3.0 adds an async batch verb. See CHANGELOG.md for what's landed.
Installation
pip install opensincera-python
The distribution is opensincera-python; the import is opensincera.
Configuration
The library and CLI read the API key from the OPENSINCERA_API_KEY environment variable. Using direnv with a gitignored .envrc is the recommended local pattern — never commit .env files.
export OPENSINCERA_API_KEY="..."
The CLI also accepts --api-key TOKEN for ad-hoc overrides.
Quickstart — library
import opensincera
with opensincera.Client(api_key="...") as client:
pub = client.get_publisher_by_domain("nytimes.com")
print(pub.publisher_id, pub.name, pub.domain)
# 75 NY Times nytimes.com
# Look up by ID
same = client.get_publisher_by_id(75)
Client honors Retry-After on 429 with capped exponential-backoff fallback (3 attempts by default — max_retry_attempts is configurable). All errors derive from opensincera.OpenSinceraError; specific subclasses cover auth, not-found, rate-limit (with retry_after), server, and timeout cases.
Quickstart — CLI
opensincera get nytimes.com
Default format is a Rich table on a TTY, JSON when piped. The full publisher record looks like:
{
"publisher_id": 75,
"name": "NY Times",
"domain": "nytimes.com",
"visit_enabled": true,
"status": "available",
"primary_supply_type": "web",
"categories": null,
"avg_ads_to_content_ratio": 0.14832,
"avg_ads_in_view": 0.50104,
"avg_ad_refresh": null,
"device_level_metrics": {
"mobile": { "avg_ad_units_in_view": 0.41351, "avg_ads_to_content_ratio": 0.15914, "...": "..." },
"desktop": { "avg_ad_units_in_view": 0.58246, "avg_ads_to_content_ratio": 0.13825, "...": "..." }
},
"total_supply_paths": 30,
"owner_domain": "nytimes.com",
"...": "..."
}
Project to just the fields you care about — repeat --field to add more:
opensincera get nytimes.com --field publisher_id --field status
# {"publisher_id": 75, "status": "available"}
Drill into a single device-metrics block (identifier fields are always preserved):
opensincera get nytimes.com --device mobile --format json
# { "publisher_id": 75, "name": "NY Times", "domain": "nytimes.com",
# "avg_ad_units_in_view": 0.41351, "avg_ads_to_content_ratio": 0.15914, ... }
Look up by publisher ID instead of domain:
opensincera get --id 75
Other useful flags: --format json|csv|table, --timeout SECONDS, --version, --install-completion. Run opensincera get --help for the full list.
Development
uv sync --all-groups # install runtime + dev deps
uv run pre-commit install # one-time, enables the local git hook
uv run pytest # run the test suite
uv run pre-commit run --all-files
License
Metadata
Release files for opensincera-python 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| opensincera_python-0.1.0.tar.gz | 8.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opensincera_python-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.1 kB
Release files / opensincera_python-0.1.0.tar.gz
| Download URL | opensincera_python-0.1.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d372eb733dfac2578ada871e0f06930c124b2cd0ab31c835f798408ca2d26ad
|
|
BLAKE2b-256 checksum How to use checksums |
a0f6d4b9b93a6f49785cdadc34057a1b054579e33ed9fad379f3fb915ba117a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / opensincera_python-0.1.0-py3-none-any.whl
| Download URL | opensincera_python-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54c85297d49a250513f9bcdb48f2fa11a7be7050717b28f266b8521df763e5af
|
|
BLAKE2b-256 checksum How to use checksums |
c4875e8ed3714b9c401d0fb5ffeff5c060654c4fde2f45f46d1873ddd1bbee40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for opensincera-python 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.