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.1.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.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tripwire_server-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 57477dd378a386837dc0bad519acf402e140e95bd6dec54bae49aaa119a9665c
MD5 a1071bdbdb59ea4c356ef7f595f348b0
BLAKE2b-256 ea4f5bcc7dea008df1eb2d56e9631f9075225b5b8d65ea3895485eabcb03acd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for tripwire_server-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tripwire_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aaaebe00b859e11aff9e6716eb067044428789fd68a2d9f278e0defc43d6792a
MD5 2a6f9abd627473b4ee3730b16fc8398f
BLAKE2b-256 5e256255b8e19da1c6f1dff9384620ac4f39b91b3d3d3537752e8a5cf238e748

See more details on using hashes here.

Provenance

The following attestation bundles were made for tripwire_server-0.1.1-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