Skip to content
Feralin

Developers

Python: quickstart

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

Install

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

pip install -e sdks/python          # veya: PYTHONPATH=sdks/python/src

First use

from feralin import Client, Consent, Context, RejectedError, TemporaryError

client = Client(
    "pk_live_…", "https://collect.example.com",
    consent=Consent(analytics=True),  # consent-first: varsayılan analytics=False
    flush_interval=2.0,               # 0 → arka plan (daemon thread) gönderici kapalı
    batch_size=100,                   # ≤ 500
    queue_limit=1000,                 # aşılırsa en eski olay atılır
    timeout=10.0,
)

event = client.track(
    "order_completed",                                   # snake_case, ≤100
    {"order_id": "ord_1", "amount": 249.9},              # ≤100 anahtar, ^[a-zA-Z][a-zA-Z0-9_]{0,63}$
    user_id="user_42",                                   # müşteri uygulamasının kimliği; PII değil
    context=Context(locale="tr-TR", timezone="Europe/Istanbul"),
)
# consent.analytics False → None döner (olay üretilmez, istisna yok; Web SDK ile tutarlı)
# doğrulama hatası       → InvalidEventError (ValueError)

result = client.flush()          # fırlatmaz; sonuç result.error içinde
if result.ok: ...                # 202: result.accepted / rejected / batch_id
elif isinstance(result.error, RejectedError): ...   # 4xx (429 hariç): olaylar atıldı
elif isinstance(result.error, TemporaryError): ...  # 5xx / 429 / ağ: kuyrukta, backoff 1 sn → 30 sn (Retry-After'a uyar)

client.close()                   # kalan olayları en fazla 5 sn içinde gönderir; `with Client(...) as c:` de desteklenir
client.set_global_properties({"app_release": "2.4.0"})        # adı fr_ ile başlamayan her olaya eklenir; None anahtarı siler
client.set_user_properties({"plan": "pro"}, user_id="user_42")  # fr_user_properties; geçerli özellik yoksa None
client.group("acme-team", {"plan": "team"}, user_id="user_42")  # fr_group; geçersiz group_id → None
client.clear_global_properties()
client = Client("pk_live_…", "https://collect.example.com", app_version="2.4.0", error_sample_rate=1.0)
try:
    charge()
except Exception as exc:
    client.capture_error(exc, user_id="user_42")  # varsayılan origin "handled"; izin yoksa ya da sınır aşıldıysa None

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

Capabilities

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

Verification chain

Python 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.