Tripwire Python Library
The Tripwire Python library provides convenient access to the Tripwire API from applications written in Python. It includes a synchronous client for Sessions, Fingerprints, Organizations, Organization API key management, sealed token verification, Gate, and Gate delivery/webhook helpers.
The library also provides:
- a fast configuration path using
TRIPWIRE_SECRET_KEY - iterator helpers for cursor-based pagination
- structured API errors and built-in sealed token verification
- webhook endpoint management, test sends, and event delivery history
- public, bearer-token, and secret-key auth modes for Gate flows
- Gate delivery/webhook helpers
Documentation
See the Tripwire docs and API reference.
Installation
You don't need this source code unless you want to modify the package. If you just want to use the package, run:
pip install tripwire-server
Requirements
- Python 3.10+
Usage
Use TRIPWIRE_SECRET_KEY or secret_key=... for core detect APIs. For public or bearer-auth Gate flows, the client can also be created without a secret key:
from tripwire_server import Tripwire
client = Tripwire(secret_key="sk_live_...")
page = client.sessions.list(verdict="bot", limit=25)
session = client.sessions.get("sid_123")
Sealed token verification
from tripwire_server import safe_verify_tripwire_token
result = safe_verify_tripwire_token(
sealed_token,
"sk_live_...",
)
if result.ok:
print(result.data.verdict, result.data.score)
else:
print(result.error)
Pagination
for session in client.sessions.iter(search="signup"):
print(session.id, session.latest_decision.verdict)
Fingerprints
page = client.fingerprints.list(sort="seen_count")
fingerprint = client.fingerprints.get("vid_123")
Organizations
organization = client.organizations.get("org_123")
updated = client.organizations.update("org_123", name="New Name")
Organization API keys
created = client.organizations.api_keys.create(
"org_123",
name="Production",
type="secret",
scopes=["sessions:list", "sessions:read"],
)
client.organizations.api_keys.revoke("org_123", created.id)
Webhooks
endpoint = client.webhooks.create_endpoint(
"org_123",
name="Production alerts",
url="https://example.com/tripwire/webhook",
event_types=["session.result.persisted", "gate.session.approved"],
)
events = client.webhooks.list_events(
"org_123",
endpoint_id=endpoint.id,
type="session.result.persisted",
)
print(events.items[0].webhook_deliveries[0].status)
Gate APIs
from tripwire_server import Tripwire, create_delivery_key_pair
client = Tripwire()
services = client.gate.registry.list()
session = client.gate.sessions.create(
service_id="tripwire",
account_name="my-project",
delivery=create_delivery_key_pair().delivery,
)
print(services[0].id, session.consent_url)
Gate delivery and webhook helpers
from tripwire_server import (
create_delivery_key_pair,
create_gate_approved_webhook_response,
decrypt_gate_delivery_envelope,
parse_webhook_event,
verify_gate_webhook_signature,
)
key_pair = create_delivery_key_pair()
response = create_gate_approved_webhook_response(
{
"delivery": key_pair.delivery,
"outputs": {
"TRIPWIRE_PUBLISHABLE_KEY": "pk_live_...",
"TRIPWIRE_SECRET_KEY": "sk_live_...",
},
}
)
payload = decrypt_gate_delivery_envelope(key_pair.private_key, response.encrypted_delivery)
print(payload.outputs["TRIPWIRE_SECRET_KEY"])
raw_body = '{"id":"wevt_123","object":"webhook_event","type":"webhook.test","created":"2026-04-26T00:00:00.000Z","data":{}}'
print(
verify_gate_webhook_signature(
secret="whsec_test",
timestamp="1735776000",
raw_body=raw_body,
signature="…",
)
)
event = parse_webhook_event(raw_body)
print(event.type)
Error handling
from tripwire_server import TripwireApiError
try:
client.sessions.list(limit=999)
except TripwireApiError as error:
print(error.status, error.code, error.message)
Support
If you need help integrating Tripwire, start with tripwirejs.com/docs.
Metadata
Release files for tripwire-server 0.2.2
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 | Actions |
|---|---|---|---|---|
| tripwire_server-0.2.2.tar.gz | 88.6 kB | With provenance | Details for tripwire_server-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tripwire_server-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for tripwire_server-0.2.2-py3-none-any.whl |
Total release size: 108.7 kB
Release files / tripwire_server-0.2.2.tar.gz
| Download URL | tripwire_server-0.2.2.tar.gz |
|---|---|
| Size | 88.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9026c271e0a82b7e6a1003d1f2a3d796754b92644398953a76627aefd40a0888
|
|
BLAKE2b-256 checksum How to use checksums |
895b26c066a978476c09115f09eaab047919e3b47221147cae8e3ef03f8a3081
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 14, 2026.
Transparency logRelease files / tripwire_server-0.2.2-py3-none-any.whl
| Download URL | tripwire_server-0.2.2-py3-none-any.whl |
|---|---|
| Size | 20.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3a369508d3edee05bcdd619c72d65497215a7d863da9cab6ed053fc2b7381e4
|
|
BLAKE2b-256 checksum How to use checksums |
8131379b869e0b03ddf99f71d1a791302d0f06fe43571e31267d4599689d0ecd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 14, 2026.
Transparency logSecurity for tripwire-server 0.2.2
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
Both files in this release have been uploaded with provenance metadata.
Attestation for tripwire_server-0.2.2.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 May 14, 2026.
Transparency logA 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.