Skip to content
Feralin

Developers

FastAPI: quickstart

Install and first-use steps for sending events to Feralin with FastAPI. Code samples come from the SDK's own README and statuses from the capability record.

Install

feralin-fastapi 0.1.0 is published on PyPI; install it with your package manager using the command below.

pip install ./sdks/python ./sdks/python-fastapi fastapi

First use

from fastapi import Depends, FastAPI, Request
from feralin import Consent
from feralin_fastapi import FeralinMiddleware, RequestFeralin, get_feralin

def izin(request: Request) -> Consent:
    return Consent(analytics=request.cookies.get("izin") == "evet")

app = FastAPI()
app.add_middleware(
    FeralinMiddleware,
    project_key=os.environ["FERALIN_PROJECT_KEY"],  # yalnız pk_ anahtarı
    collect_url="https://collect.example.com",
    resolve_consent=izin,
)

@app.post("/siparis")
async def siparis(feralin: RequestFeralin = Depends(get_feralin)):
    feralin.track("order_completed", {"order_id": "ord_1"})

Code samples are taken as they are from sdks/python-fastapi/README.md; comments inside may be in Turkish. You create the project key in the dashboard.

Capabilities

FastAPI capability status
CapabilityStatus
Event sendingSupported
Batch sendingPartial
Consent handlingSupported
IdentitySupported
AttributionNot applicable
Deep linksNot applicable
RevenuePartial
Error capturePartial
Session replayNot applicable
TracingPlanned

Verification chain

FastAPI verification chain
LinkStatus
SourcePassed
BuildPassed
TestPassed
Registry publicationPassed
Clean installPassed
Event receiptPassed
DocumentationPassed
Super Admin proofNot started

Passed means local evidence: source, build and tests ran. Registry publication and Super Admin proof are separate links; the SDK is not called ready until each has passed.