Skip to main content

Official Tripwire Python server SDK

Project description

Tripwire Python Library

Preview Python 3.10+ License: MIT

The Tripwire Python library provides convenient access to the Tripwire API from applications written in Python. It includes a synchronous client for Sessions, Fingerprints, Teams, Team API key management, and sealed token verification.

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

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

The library needs to be configured with your account's secret key. Set TRIPWIRE_SECRET_KEY in your environment or pass secret_key directly:

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_result.verdict)

Fingerprints

page = client.fingerprints.list(sort="seen_count")
fingerprint = client.fingerprints.get("vis_123")

Teams

team = client.teams.get("team_123")
updated = client.teams.update("team_123", name="New Name")

Team API keys

created = client.teams.api_keys.create(
    "team_123",
    name="Production",
    allowed_origins=["https://example.com"],
)

client.teams.api_keys.revoke("team_123", created.id)

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tripwire_server-0.1.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tripwire_server-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file tripwire_server-0.1.0.tar.gz.

File metadata

  • Download URL: tripwire_server-0.1.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tripwire_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3aa26c1ec93dbd4726fa9f2bc4badea9702b5e656b5d7362a129b336db7203aa
MD5 9a056df8f52c6d3db7dac0ed7ebb5c53
BLAKE2b-256 eca41cb573d2720921777ab59c2c3f81491d9d517c5fa015f825382086e7dd0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tripwire_server-0.1.0.tar.gz:

Publisher: release.yml on abxy-labs/tripwire-server-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tripwire_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tripwire_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14786bd7418f725c0e98cbe4cb2f27e74f72b55f22e7c10b52afc1b5afabc6e7
MD5 e67fb156984e2bb288cc96be9a42aee3
BLAKE2b-256 4e480caf96d28462da85bb6ae926e3fcf804d84cb52b431c6e8b47183d093aca

See more details on using hashes here.

Provenance

The following attestation bundles were made for tripwire_server-0.1.0-py3-none-any.whl:

Publisher: release.yml on abxy-labs/tripwire-server-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page