Skip to main content

Cadmium SDK for capturing and sending FastAPI errors

Project description

Cadmium-FastAPI SDK

This SDK captures and sends errors from your FastAPI application to the Cadmium server.

Installation

pip install cadmium-fastapi-sdk

Configuration

Add the following to your FastAPI application:

from fastapi import FastAPI
from cadmium_fastapi import CadmiumMiddleware

app = FastAPI()

# Add Cadmium middleware
app.add_middleware(
    CadmiumMiddleware,
    application_id="your-application-id",
    cd_secret="your-secret",
    cd_id="your-cd-id"
)

Environment Variables (Alternative Configuration)

You can also configure using environment variables:

export CADMIUM_APPLICATION_ID="your-application-id"
export CADMIUM_CD_SECRET="your-secret"
export CADMIUM_CD_ID="your-cd-id"

Then simply add the middleware without parameters:

from cadmium_fastapi import CadmiumMiddleware

app.add_middleware(CadmiumMiddleware)

Usage

Once configured, any unhandled exception will automatically be sent to the Cadmium server.

Manual Error Reporting

You can also manually report errors:

from cadmium_fastapi import report_error

try:
    # Your code here
    pass
except Exception as e:
    await report_error(e, request)

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

cadmium_fastapi_sdk-1.0.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

cadmium_fastapi_sdk-1.0.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file cadmium_fastapi_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: cadmium_fastapi_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cadmium_fastapi_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8bd5a8bf3dfa3de841534d9a017a7fcbeb027185157277f7ec2fede734a762b5
MD5 4622115c42d4050f11bfb521513b12d9
BLAKE2b-256 d96fd2a275279e58985e1c4ec886b64cd1f7f289795743af2f5e890370cf4d93

See more details on using hashes here.

File details

Details for the file cadmium_fastapi_sdk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cadmium_fastapi_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2771d5a1ad75e15d2e4fc1d0af4cca796b3f4b148156f8db05b7a4a722aaac79
MD5 71cf34bc510cbb5ef167c305a60d9b4b
BLAKE2b-256 c6ad17d39b56fb9f4a9bf36d38c37c8b12efce03d998238cf2ca00690d328517

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