feralin 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- feralin-0.1.0/LICENSE +21 -0
- feralin-0.1.0/PKG-INFO +126 -0
- feralin-0.1.0/README.md +99 -0
- feralin-0.1.0/pyproject.toml +42 -0
- feralin-0.1.0/setup.cfg +4 -0
- feralin-0.1.0/src/feralin/__init__.py +92 -0
- feralin-0.1.0/src/feralin/client.py +599 -0
- feralin-0.1.0/src/feralin/error_capture.py +141 -0
- feralin-0.1.0/src/feralin/errors.py +37 -0
- feralin-0.1.0/src/feralin/events.py +162 -0
- feralin-0.1.0/src/feralin/profile.py +133 -0
- feralin-0.1.0/src/feralin/py.typed +0 -0
- feralin-0.1.0/src/feralin/revenue.py +78 -0
- feralin-0.1.0/src/feralin/transport.py +30 -0
- feralin-0.1.0/src/feralin/ulid.py +67 -0
- feralin-0.1.0/src/feralin.egg-info/PKG-INFO +126 -0
- feralin-0.1.0/src/feralin.egg-info/SOURCES.txt +21 -0
- feralin-0.1.0/src/feralin.egg-info/dependency_links.txt +1 -0
- feralin-0.1.0/src/feralin.egg-info/top_level.txt +1 -0
- feralin-0.1.0/tests/test_client.py +434 -0
- feralin-0.1.0/tests/test_error_capture.py +115 -0
- feralin-0.1.0/tests/test_profile.py +112 -0
- feralin-0.1.0/tests/test_ulid.py +73 -0
feralin-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Feralin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
feralin-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: feralin
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Feralin UTP v1 server SDK (Python) — yalnız standart kütüphane, consent-first, at-least-once batch gönderimi
|
|
5
|
+
Author: Feralin
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://feralin.com
|
|
8
|
+
Project-URL: Repository, https://github.com/feralincom/sdk
|
|
9
|
+
Project-URL: Documentation, https://github.com/feralincom/sdk/blob/main/docs/sdk/python.md
|
|
10
|
+
Project-URL: Changelog, https://github.com/feralincom/sdk/blob/main/sdks/python/CHANGELOG.md
|
|
11
|
+
Keywords: analytics,attribution,feralin,utp,events
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# Feralin Python SDK (`feralin`) — UTP v1 server client
|
|
29
|
+
|
|
30
|
+
Feralin toplayıcısına (`services/collect`, `POST /v1/batch`) **sunucu tarafından** olay gönderen resmî Python SDK'sı
|
|
31
|
+
(Django, FastAPI, Flask, worker'lar). Yalnız standart kütüphane (`urllib`, `threading`, `json`, `secrets`); dış
|
|
32
|
+
bağımlılık yok. Python ≥ 3.10, tür ipuçları ve `py.typed` ile.
|
|
33
|
+
|
|
34
|
+
## Durum (dürüst)
|
|
35
|
+
|
|
36
|
+
| Konu | Durum |
|
|
37
|
+
|---|---|
|
|
38
|
+
| Kod: `Client`, `track`, `identify`, `set_consent`, `flush`, `close`, `status` | `TESTING` — gerçek yerel `http.server` ile 28 `unittest` testi geçti |
|
|
39
|
+
| Yayın: `pip install feralin` | **Henüz yayımlanmadı — `BLOCKED_EXTERNAL`.** PyPI hesabı + 2FA + API token gerekir; `feralin` adı doğrulanmadı. Yaşam döngüsü `PROPOSED → … → PUBLISHED → REGISTRY_VERIFIED → INSTALL_VERIFIED → SUPPORTED`: `docs/sdk/capability-matrix.md` §0 ve §4 |
|
|
40
|
+
| Gerçek `collect` ile uçtan uca | Bu ortamda yalnız sahte sunucu; live-dev'de `examples/basic.py` ile `202` kanıtı alınmalı |
|
|
41
|
+
| İmzalı server event (`verified`), OTel tracing, async istemci | Yok — F3/F5 (`verified` alanı istemciden **asla** gönderilmez; `track_revenue` `feralin_purchase` istemci beyanı üretir, doğrulama sunucuda) |
|
|
42
|
+
|
|
43
|
+
## Kurulum
|
|
44
|
+
|
|
45
|
+
Yayın öncesi monorepo içinden:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install -e sdks/python # veya: PYTHONPATH=sdks/python/src
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Yayın sonrası (henüz çalışmaz): `pip install feralin`.
|
|
52
|
+
|
|
53
|
+
## Kullanım
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from feralin import Client, Consent, Context, RejectedError, TemporaryError
|
|
57
|
+
|
|
58
|
+
client = Client(
|
|
59
|
+
"pk_live_…", "https://collect.example.com",
|
|
60
|
+
consent=Consent(analytics=True), # consent-first: varsayılan analytics=False
|
|
61
|
+
flush_interval=2.0, # 0 → arka plan (daemon thread) gönderici kapalı
|
|
62
|
+
batch_size=100, # ≤ 500
|
|
63
|
+
queue_limit=1000, # aşılırsa en eski olay atılır
|
|
64
|
+
timeout=10.0,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
event = client.track(
|
|
68
|
+
"order_completed", # snake_case, ≤100
|
|
69
|
+
{"order_id": "ord_1", "amount": 249.9}, # ≤100 anahtar, ^[a-zA-Z][a-zA-Z0-9_]{0,63}$
|
|
70
|
+
user_id="user_42", # müşteri uygulamasının kimliği; PII değil
|
|
71
|
+
context=Context(locale="tr-TR", timezone="Europe/Istanbul"),
|
|
72
|
+
)
|
|
73
|
+
# consent.analytics False → None döner (olay üretilmez, istisna yok; Web SDK ile tutarlı)
|
|
74
|
+
# doğrulama hatası → InvalidEventError (ValueError)
|
|
75
|
+
|
|
76
|
+
result = client.flush() # fırlatmaz; sonuç result.error içinde
|
|
77
|
+
if result.ok: ... # 202: result.accepted / rejected / batch_id
|
|
78
|
+
elif isinstance(result.error, RejectedError): ... # 4xx (429 hariç): olaylar atıldı
|
|
79
|
+
elif isinstance(result.error, TemporaryError): ... # 5xx / 429 / ağ: kuyrukta, backoff 1 sn → 30 sn (Retry-After'a uyar)
|
|
80
|
+
|
|
81
|
+
client.close() # kalan olayları en fazla 5 sn içinde gönderir; `with Client(...) as c:` de desteklenir
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Örnek: `FERALIN_PROJECT_KEY=pk_live_… FERALIN_COLLECT_URL=http://127.0.0.1:8081 PYTHONPATH=sdks/python/src python sdks/python/examples/basic.py`
|
|
85
|
+
(yerel `collect` için anahtar `COLLECT_PROJECT_KEYS="pk_live_…=tenant_dev:proj_dev"` ile tanımlanmalı; SDK `pk_` dışındaki anahtarı reddeder).
|
|
86
|
+
|
|
87
|
+
### Kimlik yöntemleri (UTP §8.2)
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
client.set_global_properties({"app_release": "2.4.0"}) # adı fr_ ile başlamayan her olaya eklenir; None anahtarı siler
|
|
91
|
+
client.set_user_properties({"plan": "pro"}, user_id="user_42") # fr_user_properties; geçerli özellik yoksa None
|
|
92
|
+
client.group("acme-team", {"plan": "team"}, user_id="user_42") # fr_group; geçersiz group_id → None
|
|
93
|
+
client.clear_global_properties()
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Hata yakalama (`fr_error`)
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
client = Client("pk_live_…", "https://collect.example.com", app_version="2.4.0", error_sample_rate=1.0)
|
|
100
|
+
try:
|
|
101
|
+
charge()
|
|
102
|
+
except Exception as exc:
|
|
103
|
+
client.capture_error(exc, user_id="user_42") # varsayılan origin "handled"; izin yoksa ya da sınır aşıldıysa None
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Gövde Android, React Native ve Web SDK ile aynı sözleşmedir: `error_type` (paketsiz tür adı, ≤64), temizlenmiş `message` (URL, e-posta, UUID, rakam içeren uzun belirteç ve en az 7 haneli sayı etiketlenir, ≤200), `fingerprint` (tür ve ilk beş çerçevenin FNV-1a 64 özeti, 16 onaltılı; çerçeve yoksa rakamsız mesaj), `top_frame`, `frame_count`, `app_version` (verildiyse, ≤32), `handled`, `fatal`, `origin` (`handled`, `manual`, `uncaught_exception`). Ham yığın izi, dosya yolu ve satır numarası gitmez. Süreç başına en çok 20, aynı parmak izi için en çok 3 olay; izin yoksa olay üretilmez. Çerçeveler `__traceback__` üzerinden `modül.işlev` biçimindedir, en içteki önce; uygulama çerçevesi varsa standart kütüphane ve SDK çerçeveleri atılır.
|
|
107
|
+
|
|
108
|
+
Kurallar bütün SDK'larda ve toplayıcıda aynıdır: anahtar `^[a-zA-Z][a-zA-Z0-9_]{0,63}$`, çağrı başına en çok 50 özellik; değer yalnız dizge (≤256 karakter, kontrol karakteri yok, e-posta biçiminde değil), sonlu sayı ya da mantıksal. Doğrulama alanları (`verified`, `receipt` vb.) ve kişisel veriye benzeyen anahtarlar (e-posta, telefon, IP, ad soyad, adres, kimlik numarası, parola, doğum tarihi) istemcide düşer. Toplayıcı ayrıca projenin özellik izin listesini uygular: listede olmayan anahtar saklanmaz, liste boşsa olay sayılır ama hiçbir özellik saklanmaz. Olayın kendi özelliği aynı anahtardaki globali ezer; global en çok 50 anahtar tutar. `group_id` 1-128 karakterdir, `@` ve kontrol karakteri içeremez.
|
|
109
|
+
|
|
110
|
+
## Sözleşme
|
|
111
|
+
|
|
112
|
+
- Tel biçimi `packages/schemas/utp/v1/event.schema.json` ile birebir: `platform="python"`, `schema_version=1`,
|
|
113
|
+
`sdk={name:"feralin-python",version:"0.1.0"}`, `occurred_at` UTC RFC3339 ms, `event_id` monotonik ULID.
|
|
114
|
+
- `tenant_id`, `project_id`, `verified` **gönderilmez**; sunucu `X-Feralin-Project-Key` bağlamından çözer.
|
|
115
|
+
- `Idempotency-Key`, Web SDK ile aynıdır: sıralı tüm `event_id` değerlerinin FNV-1a 64 özeti ve olay sayısı. Sonucu bilinmeyen batch aynı içerik ve aynı anahtarla yeniden denenir; araya giren olaylar sonraki batch'e kalır.
|
|
116
|
+
- `fr_click` yalnız `consent.advertising` doğruysa gönderilir, aksi halde olaydan çıkarılır.
|
|
117
|
+
- Aynı anda tek gönderici; `track` iş parçacığı güvenlidir. Kuyruk bellek içidir (süreç ölürse kaybolur).
|
|
118
|
+
- Taşıma katmanı değiştirilebilir: `Client(..., transport=my_transport)` (`feralin.Transport` imzası).
|
|
119
|
+
- Loglar `logging.getLogger("feralin")` altında; anahtar ve ham olay içeriği loglanmaz.
|
|
120
|
+
|
|
121
|
+
## Geliştirme
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python -m unittest discover -s sdks/python/tests -v
|
|
125
|
+
python -I -m compileall -q sdks/python
|
|
126
|
+
```
|
feralin-0.1.0/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Feralin Python SDK (`feralin`) — UTP v1 server client
|
|
2
|
+
|
|
3
|
+
Feralin toplayıcısına (`services/collect`, `POST /v1/batch`) **sunucu tarafından** olay gönderen resmî Python SDK'sı
|
|
4
|
+
(Django, FastAPI, Flask, worker'lar). Yalnız standart kütüphane (`urllib`, `threading`, `json`, `secrets`); dış
|
|
5
|
+
bağımlılık yok. Python ≥ 3.10, tür ipuçları ve `py.typed` ile.
|
|
6
|
+
|
|
7
|
+
## Durum (dürüst)
|
|
8
|
+
|
|
9
|
+
| Konu | Durum |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Kod: `Client`, `track`, `identify`, `set_consent`, `flush`, `close`, `status` | `TESTING` — gerçek yerel `http.server` ile 28 `unittest` testi geçti |
|
|
12
|
+
| Yayın: `pip install feralin` | **Henüz yayımlanmadı — `BLOCKED_EXTERNAL`.** PyPI hesabı + 2FA + API token gerekir; `feralin` adı doğrulanmadı. Yaşam döngüsü `PROPOSED → … → PUBLISHED → REGISTRY_VERIFIED → INSTALL_VERIFIED → SUPPORTED`: `docs/sdk/capability-matrix.md` §0 ve §4 |
|
|
13
|
+
| Gerçek `collect` ile uçtan uca | Bu ortamda yalnız sahte sunucu; live-dev'de `examples/basic.py` ile `202` kanıtı alınmalı |
|
|
14
|
+
| İmzalı server event (`verified`), OTel tracing, async istemci | Yok — F3/F5 (`verified` alanı istemciden **asla** gönderilmez; `track_revenue` `feralin_purchase` istemci beyanı üretir, doğrulama sunucuda) |
|
|
15
|
+
|
|
16
|
+
## Kurulum
|
|
17
|
+
|
|
18
|
+
Yayın öncesi monorepo içinden:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install -e sdks/python # veya: PYTHONPATH=sdks/python/src
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Yayın sonrası (henüz çalışmaz): `pip install feralin`.
|
|
25
|
+
|
|
26
|
+
## Kullanım
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from feralin import Client, Consent, Context, RejectedError, TemporaryError
|
|
30
|
+
|
|
31
|
+
client = Client(
|
|
32
|
+
"pk_live_…", "https://collect.example.com",
|
|
33
|
+
consent=Consent(analytics=True), # consent-first: varsayılan analytics=False
|
|
34
|
+
flush_interval=2.0, # 0 → arka plan (daemon thread) gönderici kapalı
|
|
35
|
+
batch_size=100, # ≤ 500
|
|
36
|
+
queue_limit=1000, # aşılırsa en eski olay atılır
|
|
37
|
+
timeout=10.0,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
event = client.track(
|
|
41
|
+
"order_completed", # snake_case, ≤100
|
|
42
|
+
{"order_id": "ord_1", "amount": 249.9}, # ≤100 anahtar, ^[a-zA-Z][a-zA-Z0-9_]{0,63}$
|
|
43
|
+
user_id="user_42", # müşteri uygulamasının kimliği; PII değil
|
|
44
|
+
context=Context(locale="tr-TR", timezone="Europe/Istanbul"),
|
|
45
|
+
)
|
|
46
|
+
# consent.analytics False → None döner (olay üretilmez, istisna yok; Web SDK ile tutarlı)
|
|
47
|
+
# doğrulama hatası → InvalidEventError (ValueError)
|
|
48
|
+
|
|
49
|
+
result = client.flush() # fırlatmaz; sonuç result.error içinde
|
|
50
|
+
if result.ok: ... # 202: result.accepted / rejected / batch_id
|
|
51
|
+
elif isinstance(result.error, RejectedError): ... # 4xx (429 hariç): olaylar atıldı
|
|
52
|
+
elif isinstance(result.error, TemporaryError): ... # 5xx / 429 / ağ: kuyrukta, backoff 1 sn → 30 sn (Retry-After'a uyar)
|
|
53
|
+
|
|
54
|
+
client.close() # kalan olayları en fazla 5 sn içinde gönderir; `with Client(...) as c:` de desteklenir
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Örnek: `FERALIN_PROJECT_KEY=pk_live_… FERALIN_COLLECT_URL=http://127.0.0.1:8081 PYTHONPATH=sdks/python/src python sdks/python/examples/basic.py`
|
|
58
|
+
(yerel `collect` için anahtar `COLLECT_PROJECT_KEYS="pk_live_…=tenant_dev:proj_dev"` ile tanımlanmalı; SDK `pk_` dışındaki anahtarı reddeder).
|
|
59
|
+
|
|
60
|
+
### Kimlik yöntemleri (UTP §8.2)
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
client.set_global_properties({"app_release": "2.4.0"}) # adı fr_ ile başlamayan her olaya eklenir; None anahtarı siler
|
|
64
|
+
client.set_user_properties({"plan": "pro"}, user_id="user_42") # fr_user_properties; geçerli özellik yoksa None
|
|
65
|
+
client.group("acme-team", {"plan": "team"}, user_id="user_42") # fr_group; geçersiz group_id → None
|
|
66
|
+
client.clear_global_properties()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Hata yakalama (`fr_error`)
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
client = Client("pk_live_…", "https://collect.example.com", app_version="2.4.0", error_sample_rate=1.0)
|
|
73
|
+
try:
|
|
74
|
+
charge()
|
|
75
|
+
except Exception as exc:
|
|
76
|
+
client.capture_error(exc, user_id="user_42") # varsayılan origin "handled"; izin yoksa ya da sınır aşıldıysa None
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Gövde Android, React Native ve Web SDK ile aynı sözleşmedir: `error_type` (paketsiz tür adı, ≤64), temizlenmiş `message` (URL, e-posta, UUID, rakam içeren uzun belirteç ve en az 7 haneli sayı etiketlenir, ≤200), `fingerprint` (tür ve ilk beş çerçevenin FNV-1a 64 özeti, 16 onaltılı; çerçeve yoksa rakamsız mesaj), `top_frame`, `frame_count`, `app_version` (verildiyse, ≤32), `handled`, `fatal`, `origin` (`handled`, `manual`, `uncaught_exception`). Ham yığın izi, dosya yolu ve satır numarası gitmez. Süreç başına en çok 20, aynı parmak izi için en çok 3 olay; izin yoksa olay üretilmez. Çerçeveler `__traceback__` üzerinden `modül.işlev` biçimindedir, en içteki önce; uygulama çerçevesi varsa standart kütüphane ve SDK çerçeveleri atılır.
|
|
80
|
+
|
|
81
|
+
Kurallar bütün SDK'larda ve toplayıcıda aynıdır: anahtar `^[a-zA-Z][a-zA-Z0-9_]{0,63}$`, çağrı başına en çok 50 özellik; değer yalnız dizge (≤256 karakter, kontrol karakteri yok, e-posta biçiminde değil), sonlu sayı ya da mantıksal. Doğrulama alanları (`verified`, `receipt` vb.) ve kişisel veriye benzeyen anahtarlar (e-posta, telefon, IP, ad soyad, adres, kimlik numarası, parola, doğum tarihi) istemcide düşer. Toplayıcı ayrıca projenin özellik izin listesini uygular: listede olmayan anahtar saklanmaz, liste boşsa olay sayılır ama hiçbir özellik saklanmaz. Olayın kendi özelliği aynı anahtardaki globali ezer; global en çok 50 anahtar tutar. `group_id` 1-128 karakterdir, `@` ve kontrol karakteri içeremez.
|
|
82
|
+
|
|
83
|
+
## Sözleşme
|
|
84
|
+
|
|
85
|
+
- Tel biçimi `packages/schemas/utp/v1/event.schema.json` ile birebir: `platform="python"`, `schema_version=1`,
|
|
86
|
+
`sdk={name:"feralin-python",version:"0.1.0"}`, `occurred_at` UTC RFC3339 ms, `event_id` monotonik ULID.
|
|
87
|
+
- `tenant_id`, `project_id`, `verified` **gönderilmez**; sunucu `X-Feralin-Project-Key` bağlamından çözer.
|
|
88
|
+
- `Idempotency-Key`, Web SDK ile aynıdır: sıralı tüm `event_id` değerlerinin FNV-1a 64 özeti ve olay sayısı. Sonucu bilinmeyen batch aynı içerik ve aynı anahtarla yeniden denenir; araya giren olaylar sonraki batch'e kalır.
|
|
89
|
+
- `fr_click` yalnız `consent.advertising` doğruysa gönderilir, aksi halde olaydan çıkarılır.
|
|
90
|
+
- Aynı anda tek gönderici; `track` iş parçacığı güvenlidir. Kuyruk bellek içidir (süreç ölürse kaybolur).
|
|
91
|
+
- Taşıma katmanı değiştirilebilir: `Client(..., transport=my_transport)` (`feralin.Transport` imzası).
|
|
92
|
+
- Loglar `logging.getLogger("feralin")` altında; anahtar ve ham olay içeriği loglanmaz.
|
|
93
|
+
|
|
94
|
+
## Geliştirme
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python -m unittest discover -s sdks/python/tests -v
|
|
98
|
+
python -I -m compileall -q sdks/python
|
|
99
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "feralin"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Feralin UTP v1 server SDK (Python) — yalnız standart kütüphane, consent-first, at-least-once batch gönderimi"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
# PEP 639 lisans ifadesi (setuptools 77+); lisans sınıflandırıcısıyla birlikte kullanılamaz.
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
authors = [{ name = "Feralin" }]
|
|
15
|
+
keywords = ["analytics", "attribution", "feralin", "utp", "events"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Typing :: Typed",
|
|
28
|
+
]
|
|
29
|
+
# Dış bağımlılık yok: urllib, threading, json, secrets ile yetinilir.
|
|
30
|
+
dependencies = []
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://feralin.com"
|
|
34
|
+
Repository = "https://github.com/feralincom/sdk"
|
|
35
|
+
Documentation = "https://github.com/feralincom/sdk/blob/main/docs/sdk/python.md"
|
|
36
|
+
Changelog = "https://github.com/feralincom/sdk/blob/main/sdks/python/CHANGELOG.md"
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.package-data]
|
|
42
|
+
feralin = ["py.typed"]
|
feralin-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Feralin UTP v1 server SDK (Python). Yalnız standart kütüphane; consent-first; at-least-once batch gönderimi."""
|
|
2
|
+
|
|
3
|
+
import logging as _logging
|
|
4
|
+
|
|
5
|
+
from .client import (
|
|
6
|
+
DEFAULT_BATCH_SIZE,
|
|
7
|
+
DEFAULT_FLUSH_INTERVAL,
|
|
8
|
+
DEFAULT_QUEUE_LIMIT,
|
|
9
|
+
MAX_BATCH_SIZE,
|
|
10
|
+
PLATFORM,
|
|
11
|
+
SDK_NAME,
|
|
12
|
+
SDK_VERSION,
|
|
13
|
+
Client,
|
|
14
|
+
)
|
|
15
|
+
from .error_capture import (
|
|
16
|
+
ERROR_EVENT_NAME,
|
|
17
|
+
ERROR_ORIGIN_HANDLED,
|
|
18
|
+
ERROR_ORIGIN_MANUAL,
|
|
19
|
+
ERROR_ORIGIN_UNCAUGHT,
|
|
20
|
+
error_properties,
|
|
21
|
+
scrub_error_message,
|
|
22
|
+
)
|
|
23
|
+
from .errors import (
|
|
24
|
+
ClientClosedError,
|
|
25
|
+
ConfigurationError,
|
|
26
|
+
DeliveryError,
|
|
27
|
+
FeralinError,
|
|
28
|
+
InvalidEventError,
|
|
29
|
+
RejectedError,
|
|
30
|
+
TemporaryError,
|
|
31
|
+
)
|
|
32
|
+
from .events import AppInfo, Consent, Context, FlushResult, Screen, UtpEvent
|
|
33
|
+
from .profile import (
|
|
34
|
+
GROUP_EVENT_NAME,
|
|
35
|
+
MAX_PROFILE_PROPERTIES,
|
|
36
|
+
USER_PROPERTIES_EVENT_NAME,
|
|
37
|
+
is_pii_like_key,
|
|
38
|
+
sanitize_profile_properties,
|
|
39
|
+
)
|
|
40
|
+
from .revenue import PURCHASE_TYPES, RECEIPT_PROVIDERS, REVENUE_EVENT_NAME, Receipt, revenue_properties
|
|
41
|
+
from .transport import Transport, urllib_transport
|
|
42
|
+
from .ulid import ULIDGenerator, is_ulid
|
|
43
|
+
|
|
44
|
+
__version__ = SDK_VERSION
|
|
45
|
+
|
|
46
|
+
# Kütüphane kuralı: uygulama logging yapılandırmadıysa SDK uyarıları stderr'e dökülmez.
|
|
47
|
+
_logging.getLogger("feralin").addHandler(_logging.NullHandler())
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
"AppInfo",
|
|
51
|
+
"Client",
|
|
52
|
+
"ClientClosedError",
|
|
53
|
+
"ConfigurationError",
|
|
54
|
+
"Consent",
|
|
55
|
+
"Context",
|
|
56
|
+
"DEFAULT_BATCH_SIZE",
|
|
57
|
+
"DEFAULT_FLUSH_INTERVAL",
|
|
58
|
+
"DEFAULT_QUEUE_LIMIT",
|
|
59
|
+
"DeliveryError",
|
|
60
|
+
"ERROR_EVENT_NAME",
|
|
61
|
+
"ERROR_ORIGIN_HANDLED",
|
|
62
|
+
"ERROR_ORIGIN_MANUAL",
|
|
63
|
+
"ERROR_ORIGIN_UNCAUGHT",
|
|
64
|
+
"FeralinError",
|
|
65
|
+
"FlushResult",
|
|
66
|
+
"GROUP_EVENT_NAME",
|
|
67
|
+
"InvalidEventError",
|
|
68
|
+
"MAX_BATCH_SIZE",
|
|
69
|
+
"MAX_PROFILE_PROPERTIES",
|
|
70
|
+
"PLATFORM",
|
|
71
|
+
"PURCHASE_TYPES",
|
|
72
|
+
"RECEIPT_PROVIDERS",
|
|
73
|
+
"REVENUE_EVENT_NAME",
|
|
74
|
+
"Receipt",
|
|
75
|
+
"RejectedError",
|
|
76
|
+
"SDK_NAME",
|
|
77
|
+
"SDK_VERSION",
|
|
78
|
+
"Screen",
|
|
79
|
+
"TemporaryError",
|
|
80
|
+
"Transport",
|
|
81
|
+
"ULIDGenerator",
|
|
82
|
+
"USER_PROPERTIES_EVENT_NAME",
|
|
83
|
+
"UtpEvent",
|
|
84
|
+
"__version__",
|
|
85
|
+
"error_properties",
|
|
86
|
+
"is_pii_like_key",
|
|
87
|
+
"is_ulid",
|
|
88
|
+
"revenue_properties",
|
|
89
|
+
"sanitize_profile_properties",
|
|
90
|
+
"scrub_error_message",
|
|
91
|
+
"urllib_transport",
|
|
92
|
+
]
|