8000 chore: update telemetry to Auth0 format with dynamic versioning by kishore7snehil · Pull Request #773 · auth0/auth0-python · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

< 8000 !-- -->
Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ tests/authentication/
src/auth0/__init__.py
src/auth0/management/__init__.py

# Telemetry customization (Auth0 format with dynamic versioning)
src/auth0/management/core/client_wrapper.py

# Files edited to incorporate both APIs
pyproject.toml
poetry.lock
Expand Down
6 changes: 5 additions & 1 deletion .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ ignore:
reason: 'patched in latest python versions: https://bugs.python.org/issue27568'
"snyk:lic:pip:certifi:MPL-2.0":
- '*':
reason: "Accepting certifi’s MPL-2.0 license for now"
reason: "Accepting certifi's MPL-2.0 license for now"
expires: "2030-12-31T23:59:59Z"
"snyk:lic:pip:cryptography:Unknown":
- '*':
reason: "Accepting cryptography's license for now"
expires: "2030-12-31T23:59:59Z"
patch: {}
24 changes: 17 additions & 7 deletions src/auth0/management/core/client_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# This file was auto-generated by Fern from our API Definition.
# Modified by Auth0 to use Auth0 telemetry format with dynamic versioning

import base64
import platform
import sys
import typing
from json import dumps

import httpx
from .http_client import AsyncHttpClient, HttpClient
Expand All @@ -21,15 +26,20 @@ def __init__(
self._timeout = timeout

def get_headers(self) -> typing.Dict[str, str]:
import platform
# Dynamically get version from package metadata
py_version = platform.python_version()
version = sys.modules["auth0"].__version__

# Build Auth0 telemetry in standard format
auth0_client = dumps({
"name": "auth0-python",
"version": version,
"env": {"python": py_version}
}).encode("utf-8")

headers: typing.Dict[str, str] = {
"User-Agent": "auth0-python/5.0.0b0",
"X-Fern-Language": "Python",
"X-Fern-Runtime": f"python/{platform.python_version()}",
"X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
"X-Fern-SDK-Name": "auth0-python",
"X-Fern-SDK-Version": "5.0.0b0",
"User-Agent": f"Python/{py_version}",
"Auth0-Client": base64.b64encode(auth0_client).decode(),
**(self.get_custom_headers() or {}),
}
headers["Authorization"] = f"Bearer {self._get_token()}"
Expand Down
0