Skip to content

Commit 02ccb63

Browse files
chore: update telemetry to Auth0 format with dynamic versioning (#773)
## Changes - Replace Fern telemetry headers (X-Fern-*) with Auth0 standard format - Use Auth0-Client header with base64-encoded JSON telemetry - Implement dynamic version reading from package metadata - Add cryptography unknown license exception to .snyk - Add client_wrapper.py to .fernignore to prevent Fern regeneration
1 parent 69c1a9e commit 02ccb63

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

.fernignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ tests/authentication/
2020
src/auth0/__init__.py
2121
src/auth0/management/__init__.py
2222

23+
# Telemetry customization (Auth0 format with dynamic versioning)
24+
src/auth0/management/core/client_wrapper.py
25+
2326
# Files edited to incorporate both APIs
2427
pyproject.toml
2528
poetry.lock

.snyk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ ignore:
1111
reason: 'patched in latest python versions: https://bugs.python.org/issue27568'
1212
"snyk:lic:pip:certifi:MPL-2.0":
1313
- '*':
14-
reason: "Accepting certifi’s MPL-2.0 license for now"
14+
reason: "Accepting certifi's MPL-2.0 license for now"
15+
expires: "2030-12-31T23:59:59Z"
16+
"snyk:lic:pip:cryptography:Unknown":
17+
- '*':
18+
reason: "Accepting cryptography's license for now"
1519
expires: "2030-12-31T23:59:59Z"
1620
patch: {}

src/auth0/management/core/client_wrapper.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# This file was auto-generated by Fern from our API Definition.
2+
# Modified by Auth0 to use Auth0 telemetry format with dynamic versioning
23

4+
import base64
5+
import platform
6+
import sys
37
import typing
8+
from json import dumps
49

510
import httpx
611
from .http_client import AsyncHttpClient, HttpClient
@@ -21,15 +26,20 @@ def __init__(
2126
self._timeout = timeout
2227

2328
def get_headers(self) -> typing.Dict[str, str]:
24-
import platform
29+
# Dynamically get version from package metadata
30+
py_version = platform.python_version()
31+
version = sys.modules["auth0"].__version__
32+
33+
# Build Auth0 telemetry in standard format
34+
auth0_client = dumps({
35+
"name": "auth0-python",
36+
"version": version,
37+
"env": {"python": py_version}
38+
}).encode("utf-8")
2539

2640
headers: typing.Dict[str, str] = {
27-
"User-Agent": "auth0-python/5.0.0b0",
28-
"X-Fern-Language": "Python",
29-
"X-Fern-Runtime": f"python/{platform.python_version()}",
30-
"X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
31-
"X-Fern-SDK-Name": "auth0-python",
32-
"X-Fern-SDK-Version": "5.0.0b0",
41+
"User-Agent": f"Python/{py_version}",
42+
"Auth0-Client": base64.b64encode(auth0_client).decode(),
3343
**(self.get_custom_headers() or {}),
3444
}
3545
headers["Authorization"] = f"Bearer {self._get_token()}"

0 commit comments

Comments
 (0)