Skip to main content

CodeWarden Python SDK - Security and observability for your applications

Project description

CodeWarden Python SDK

Security and observability SDK for Python applications.

Installation

pip install codewarden

Quick Start

import codewarden

# Initialize with your API key (get it from https://codewarden.io)
codewarden.init(
    dsn="cw_live_YOUR_API_KEY@api.codewarden.io",
    environment="production",
)

# Capture messages
codewarden.capture_message("User signed up successfully")

# Capture exceptions
try:
    risky_operation()
except Exception as e:
    codewarden.capture_exception(e)

# Add breadcrumbs for context
codewarden.add_breadcrumb("user", "Clicked checkout button")

Features

  • Error Tracking: Automatic exception capture with full stack traces
  • PII Scrubbing: Automatically redacts sensitive data (emails, credit cards, etc.)
  • Security Scanning: Scan your code for vulnerabilities
  • Breadcrumbs: Add context to your error reports

Framework Integration

Flask

from flask import Flask
import codewarden

app = Flask(__name__)
codewarden.init(dsn="cw_live_xxx@api.codewarden.io")

@app.errorhandler(Exception)
def handle_exception(e):
    codewarden.capture_exception(e)
    return "Error", 500

FastAPI

from fastapi import FastAPI
import codewarden

app = FastAPI()
codewarden.init(dsn="cw_live_xxx@api.codewarden.io")

@app.exception_handler(Exception)
async def handle_exception(request, exc):
    codewarden.capture_exception(exc)
    return {"error": "Internal error"}

Django

# settings.py
import codewarden
codewarden.init(dsn="cw_live_xxx@api.codewarden.io")

# In your middleware or views
codewarden.capture_exception(exception)

Security Scanning

from codewarden import run_security_scan

# Scan your project for vulnerabilities
result = run_security_scan("./src")

print(f"Found {result.total_count} issues")
for finding in result.findings:
    print(f"[{finding.severity}] {finding.title}")

Configuration Options

codewarden.init(
    dsn="cw_live_xxx@api.codewarden.io",
    environment="production",      # Environment name
    release="1.0.0",              # Your app version
    enable_pii_scrubbing=True,    # Auto-scrub sensitive data
    debug=False,                  # Enable debug logging
)

Links

License

MIT License - see LICENSE for details.

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

codewarden-0.1.0.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

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

codewarden-0.1.0-py3-none-any.whl (47.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codewarden-0.1.0.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for codewarden-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39db5773fc84aef3b0ac0757b8081e847b9c3f543682c1ab7a344d873f17216b
MD5 385266f5fb8ea354a293c0a80b1292c7
BLAKE2b-256 d64e0eddf5c5b98bdb3960ed216f53b1cdb2b5d193906cae3c650e035deaf992

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codewarden-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 47.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for codewarden-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb9b0ac9af4a3be94c463f6b2315bb57dbb71d349a5473151a9e11a36cb54d5e
MD5 7d48d35b5321b2d3870c86fde1094839
BLAKE2b-256 6505ae1079eface734e9b2d3839e26222523ec63ecd31e7fb31dac6ecd61f99a

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