Skip to main content

doppel-api

CI PyPI Python License Downloads Checked with ty Ruff

Modern, type-safe Python client for the Doppel API — built on HTTPX for first-class sync and async support.

API Reference: https://doppel.readme.io/reference/

Features

  • Sync and async — identical API surface via Doppel (sync) and AsyncDoppel (async)
  • Type-safe — Pydantic v2 models for every request and response payload
  • Semantic exceptions — typed error hierarchy for clean error handling
  • Webhook parsing — lightweight parse_webhook() utility for inbound events
  • Modern Python — 3.11+, built-in generics, union types, no legacy typing imports
  • Minimal dependencies — just httpx and pydantic

Installation

pip install doppel-api
# or
uv add doppel-api

Quick Start

from doppel import Doppel

client = Doppel(api_key="your-gw-key", user_api_key="your-user-key")

# Create an alert
alert = client.alerts.create(entity="https://suspicious-site.com")

# Get an alert by ID
alert = client.alerts.get(id="TST-1234")

# List alerts with filters
alerts = client.alerts.list(queue_state="monitoring", page_size=50)

# List brands
brands = client.brands.list()

# List and create protected assets
assets = client.protected_assets.list(platform_name="linkedin")
new_asset = client.protected_assets.create(
    brand_ids=["brand-id"],
    asset_value="https://linkedin.com/company/acme",
)

client.close()

Context Manager

from doppel import Doppel

with Doppel(api_key="your-gw-key", user_api_key="your-user-key") as client:
    alert = client.alerts.get(id="TST-1234")

Asynchronous

import asyncio
from doppel import AsyncDoppel

async def main():
    async with AsyncDoppel(api_key="your-gw-key", user_api_key="your-user-key") as client:
        alert = await client.alerts.get(id="TST-1234")
        brands = await client.brands.list()

asyncio.run(main())

Multi-Organization Support

client = Doppel(
    api_key="your-gw-key",
    user_api_key="your-user-key",
    organization_code="my-org",
)

Webhook Parsing

Parse inbound webhook payloads from Doppel — no framework dependency required:

from doppel.webhooks import parse_webhook

event = parse_webhook(request_body)
# Returns AlertUpdatedEvent | ReportSurfacedEvent | UrlSurfacedEvent | SMSResponseEvent | IOCUpdatedEvent

Error Handling

from doppel import Doppel, NotFoundError, RateLimitError

client = Doppel(api_key="gw-key", user_api_key="user-key")

try:
    alert = client.alerts.get(id="NONEXISTENT")
except NotFoundError:
    print("Alert not found")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")

API Coverage

Resource Methods
Alerts create, get, update, list, submit_referrer_logs
Brands list
Protected Assets list, create
Reports (deprecated) submit, get, update, list
Webhooks parse_webhook() utility

Development

# Install dependencies
task setup          # uv sync --all-groups

# Run quality checks
task check          # lint + format check + typecheck + tests

# Run tests with coverage
task test:cov       # uv run pytest --cov=doppel tests/unit

Architecture

doppel/
├── __init__.py             # Public API: Doppel, AsyncDoppel, exceptions
├── client.py               # Doppel + AsyncDoppel with @cached_property resources
├── _base_client.py         # Shared HTTP logic, dual API key auth
├── _resource.py            # SyncAPIResource / AsyncAPIResource base classes
├── exceptions.py           # DoppelError hierarchy
├── models/
│   ├── __init__.py         # Re-exports all models
│   ├── alerts.py           # AlertResponse, enums, pagination
│   ├── reports.py          # ReportResponse (deprecated)
│   ├── brands.py           # BrandResponse
│   ├── protected_assets.py # ProtectedAssetResponse, Platform enum
│   └── webhooks.py         # Webhook event payloads
├── alerts.py               # Alerts + AsyncAlerts resource
├── reports.py              # Reports + AsyncReports resource (deprecated)
├── brands.py               # Brands + AsyncBrands resource
├── protected_assets.py     # ProtectedAssets + AsyncProtectedAssets resource
├── webhooks.py             # parse_webhook() utility
└── py.typed                # PEP 561 marker

Contributing

Contributions are welcome! Please open an issue first to discuss proposed changes. See the Development section for setup instructions.

License

MIT | Changelog | PyPI

Metadata

Release files for doppel-api 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 doppel-api 0.1.0
File Size Uploaded Provenance
doppel_api-0.1.0.tar.gz 63.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for doppel-api 0.1.0
File Interpreter ABI Platform
doppel_api-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 85.4 kB

Release files / doppel_api-0.1.0.tar.gz

Download URL doppel_api-0.1.0.tar.gz
Size 63.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3fffb1a6e545971a5046e0d9837109e33940482ad40894471204a14e00583ac1
BLAKE2b-256 checksum
How to use checksums
58d11a454899a06f225d9d335d6fb378810b684265e0b30420ae2f847426eeb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL doppel_api-0.1.0-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f202e9a2344947cacfd2b912d9b643c20826c0eb5b20933d589a358f6fc349e
BLAKE2b-256 checksum
How to use checksums
4ed102e129e7258d73419f5146216480430c29adbf187261aa4ab9045d6dc187
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for doppel-api 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No 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