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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 209 additions & 2 deletions .fern/replay.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,212 @@ generations:
cli_version: unknown
generator_versions:
fernapi/fern-python-sdk: 5.26.0
current_generation: ca6941ebe04b306e94f3315865d5fd06e3b2f233
patches: []
- commit_sha: a3eace9354ccf8d76cc4439d44363b0a08e6f1d7
tree_hash: 8346a548a76aec81e3452ef7d1d86eb1df4866c9
timestamp: 2026-11-04T03:51:04.113Z
cli_version: unknown
generator_versions:
fernapi/fern-python-sdk: 5.26.0
current_generation: a3eace9354ccf8d76cc4439d44363b0a08e6f1d7
patches:
- id: patch-3bac717a
content_hash: sha256:f4ad3ba43b0430fa3dfb54bfcf588cb697efe8185eb30350f9955849f831083f
original_commit: 3bac717acae703868197afb75fc26d296957a4fd
original_message: Restore Auth0 telemetry headers and keep UPGRADING.md (#900)
original_author: Kunal Dawar <[email protected]>
base_generation: a3eace9354ccf8d76cc4439d44363b0a08e6f1d7
files:
- src/auth0/management/core/client_wrapper.py
patch_content: |
diff --git a/src/auth0/management/core/client_wrapper.py b/src/auth0/management/core/client_wrapper.py
index abce2c81..fd991f52 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
@@ -30,7 +35,18 @@ class BaseClientWrapper:
self._logging = logging

def get_headers(self) -> typing.Dict[str, str]:
+ py_version = platform.python_version()
+ version = sys.modules["auth0"].__version__
+
+ auth0_client = dumps({
+ "name": "auth0-python",
+ "version": version,
+ "env": {"python": py_version}
+ }).encode("utf-8")
+
headers: typing.Dict[str, str] = {
+ "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()}"
theirs_snapshot:
src/auth0/management/core/client_wrapper.py: |
# 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
from .logging import LogConfig, Logger


class BaseClientWrapper:
def __init__(
self,
*,
token: typing.Union[str, typing.Callable[[], str]],
headers: typing.Optional[typing.Dict[str, str]] = None,
base_url: str,
timeout: typing.Optional[float] = None,
max_retries: int = 2,
stream_reconnection_enabled: typing.Optional[bool] = None,
max_stream_reconnection_attempts: typing.Optional[int] = None,
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
):
self._token = token
self._headers = headers
self._base_url = base_url
self._timeout = timeout
self._max_retries = max_retries
self._stream_reconnection_enabled = stream_reconnection_enabled
self._max_stream_reconnection_attempts = max_stream_reconnection_attempts
self._logging = logging

def get_headers(self) -> typing.Dict[str, str]:
py_version = platform.python_version()
version = sys.modules["auth0"].__version__

auth0_client = dumps({
"name": "auth0-python",
"version": version,
"env": {"python": py_version}
}).encode("utf-8")

headers: typing.Dict[str, str] = {
"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()}"
return headers

def _get_token(self) -> str:
if isinstance(self._token, str):
return self._token
else:
return self._token()

def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]:
return self._headers

def get_base_url(self) -> str:
return self._base_url

def get_timeout(self) -> typing.Optional[float]:
return self._timeout

def get_max_retries(self) -> int:
return self._max_retries

def get_stream_reconnection_enabled(self) -> bool:
return self._stream_reconnection_enabled if self._stream_reconnection_enabled is not None else True

def get_max_stream_reconnection_attempts(self) -> typing.Optional[int]:
return self._max_stream_reconnection_attempts


class SyncClientWrapper(BaseClientWrapper):
def __init__(
self,
*,
token: typing.Union[str, typing.Callable[[], str]],
headers: typing.Optional[typing.Dict[str, str]] = None,
base_url: str,
timeout: typing.Optional[float] = None,
max_retries: int = 2,
stream_reconnection_enabled: typing.Optional[bool] = None,
max_stream_reconnection_attempts: typing.Optional[int] = None,
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
httpx_client: httpx.Client,
):
super().__init__(
token=token,
headers=headers,
base_url=base_url,
timeout=timeout,
max_retries=max_retries,
stream_reconnection_enabled=stream_reconnection_enabled,
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
logging=logging,
)
self.httpx_client = HttpClient(
httpx_client=httpx_client,
base_headers=self.get_headers,
base_timeout=self.get_timeout,
base_url=self.get_base_url,
base_max_retries=self.get_max_retries(),
logging_config=self._logging,
)


class AsyncClientWrapper(BaseClientWrapper):
def __init__(
self,
*,
token: typing.Union[str, typing.Callable[[], str]],
headers: typing.Optional[typing.Dict[str, str]] = None,
base_url: str,
timeout: typing.Optional[float] = None,
max_retries: int = 2,
stream_reconnection_enabled: typing.Optional[bool] = None,
max_stream_reconnection_attempts: typing.Optional[int] = None,
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None,
httpx_client: httpx.AsyncClient,
):
super().__init__(
token=token,
headers=headers,
base_url=base_url,
timeout=timeout,
max_retries=max_retries,
stream_reconnection_enabled=stream_reconnection_enabled,
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
logging=logging,
)
self._async_token = async_token
self.httpx_client = AsyncHttpClient(
httpx_client=httpx_client,
base_headers=self.get_headers,
base_timeout=self.get_timeout,
base_url=self.get_base_url,
base_max_retries=self.get_max_retries(),
async_base_headers=self.async_get_headers,
logging_config=self._logging,
)

async def async_get_headers(self) -> typing.Dict[str, str]:
headers = self.get_headers()
if self._async_token is not None:
token = await self._async_token()
headers["Authorization"] = f"Bearer {token}"
return headers
Loading
Loading