Skip to main content

Drop-in error reporter for ghosttrap.io

Project description

ghosttrap-sdk

Error reporting for Python apps, built for AI agents. Part of ghosttrap.

Install

pip install ghosttrap-sdk

Use

import ghosttrap
ghosttrap.init("t_your_token_here")

Get your token by running ghosttrap setup from ghosttrap-cli.

Optional kwargs

ghosttrap.init(
    "t_your_token_here",
    server="https://ghosttrap.io",  # override only if self-hosting
    send_user=False,                # see "User context" below
)

What it hooks into

  • sys.excepthook — unhandled exceptions
  • Python logginglogger.exception() and logger.error(..., exc_info=True)
  • Celery — task failures via celery.signals.task_failure (auto-detected)

What it sends

Every report includes the exception type, message, traceback, frames (file/line/function/code), and the server's hostname (socket.gethostname()).

Django

INSTALLED_APPS = [
    ...
    "ghosttrap.django.GhostTrapApp",
]

MIDDLEWARE = [
    "ghosttrap.django.GhostTrapMiddleware",
    ...
]

User context

Off by default. Pass send_user=True to init() and the Django middleware will attach the authenticated user's id and username to each report. Has no effect outside Django.

ghosttrap.init("t_your_token_here", send_user=True)

Zero dependencies

Pure Python stdlib. No transitive dependencies in your production image.

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

ghosttrap_sdk-0.4.3.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

ghosttrap_sdk-0.4.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file ghosttrap_sdk-0.4.3.tar.gz.

File metadata

  • Download URL: ghosttrap_sdk-0.4.3.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ghosttrap_sdk-0.4.3.tar.gz
Algorithm Hash digest
SHA256 47ec45b6ccc76da9c4dbf725664e634ec28e0fb2cec1b5d9bdc91e70fe0e9de9
MD5 c1cea5925a3d059750474f16ebef19e1
BLAKE2b-256 6309e53bf3ae794f6410ed3765d214b377ee8064a45869227146da02d2e599cb

See more details on using hashes here.

File details

Details for the file ghosttrap_sdk-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: ghosttrap_sdk-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ghosttrap_sdk-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d280bdd81dc01a47aa7d833fac1eb0fb720af666eb700b99382a77db7ef80e0b
MD5 97f6741efe1fe78179fa6ad499a208f3
BLAKE2b-256 1661295dd01933ef12be89693891b5f3f87bd283f542059c39b8ce1377c8dd52

See more details on using hashes here.

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