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/srcFirst 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 desteklenirclient.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 NoneCode 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
| Capability | Status |
|---|---|
| Event sending | Supported |
| Batch sending | Partial |
| Consent handling | Supported |
| Identity | Supported |
| Attribution | Not applicable |
| Deep links | Not applicable |
| Revenue | Partial |
| Error capture | Partial |
| Session replay | Not applicable |
| Tracing | Planned |
Verification chain
| Link | Status |
|---|---|
| Source | Passed |
| Build | Passed |
| Test | Passed |
| Registry publication | Passed |
| Clean install | Passed |
| Event receipt | Passed |
| Documentation | Passed |
| Super Admin proof | Not 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.