Catalog PyPI
PACKAGE EXPLORERView in registry

afen

PyPI

Afen Python SDK - capture and send runtime errors to Afen

afendebuggingerror-trackingobservability
Versions collected1
Direct dependencies1From release 1.0.2
Last observed20 Oct, 21:02 UTC

README

Version 1.0.2 documentation

Afen Python SDK

Capture runtime errors and send them to an Afen instance.

  • Automatic capture of unhandled exceptions via sys.excepthook
  • Manual capture with optional context
  • Async support
  • Django middleware integration
  • Python ≥ 3.8, zero heavy dependencies

Installation

pip install afen-client

Quick Start

from afen.client import AfenClient

client = AfenClient(
    api_url="http://localhost:3000",
    api_key="your-api-token",
    service_name="my-service",
)

That's it. A global sys.excepthook is registered automatically — all unhandled exceptions are forwarded to Afen without any further setup.


Manual Capture

try:
    process_payment(payload)
except Exception as e:
    client.capture(e, context={"order_id": payload["id"]})
    raise

Async Support

async def handler(request):
    try:
        await process_payment(payload)
    except Exception as e:
        await client.capture_async(e, context={"order_id": payload["id"]})
        raise

Disable Auto-Capture

client = AfenClient(
    api_url="http://localhost:3000",
    api_key="your-api-token",
    service_name="my-service",
    auto_capture=False,
)

Django Integration

# settings.py
MIDDLEWARE = [
    "afen.integrations.django.AfenMiddleware",
    ...
]

AFEN = {
    "API_URL": "http://localhost:3000",
    "API_KEY": "your-api-token",
    "SERVICE_NAME": "my-django-app",
}

Captures all unhandled Django exceptions and attaches request.path, request.method, and response status as context.


Configuration

ParameterTypeRequiredDefaultDescription
api_urlstr✓—Afen server URL
api_keystr✓—API key
service_namestr✓—Identifies the source service
environmentstr"development"Deployment environment
releasestrNoneRelease or version tag
auto_captureboolTrueRegister global exception hook
timeoutint5Request timeout in seconds

Requirements

  • Python ≥ 3.8
  • requests ≥ 2.28.0

License

MIT © Anamn

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.215 Jun 20261

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
v-1908/afen

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:02 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:f82e543a127a4b2344b7b3701932c120c2af599413a96ee84db3ddffc857b0f7