diff --git a/.fernignore b/.fernignore index 05428e3e..b718ba4c 100644 --- a/.fernignore +++ b/.fernignore @@ -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 diff --git a/.snyk b/.snyk index 785d93ea..c05f0bf1 100644 --- a/.snyk +++ b/.snyk @@ -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: {} diff --git a/src/auth0/management/core/client_wrapper.py b/src/auth0/management/core/client_wrapper.py index 1eb6b691..5c77cb9b 100644 --- a/src/auth0/management/core/client_wrapper.py +++ b/src/auth0/management/core/client_wrapper.py @@ -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 @@ -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()}"