-
[OPIK-2376] [P SDK] Improve HTTPX client customization API (#3245)
发布于
2025-09-15 09:52:12 +00:00 - [OPIK-2876] [P SDK] Introduce customizable hooks for HTTPX client initialization and validation
- Added
HttpxClientHookfor registering callable hooks and initialization argument overrides. - Updated HTTPX client initialization logic to support global hook application.
- Replaced deprecated hook registration with
add_httpx_client_hook. - Overhauled tests for
httpx_clientands3_httpx_clientto validate hook behavior and argument customization. - Enhanced documentation and logging for hook functionality.
- Refactored
opik/hooks.pyto manage hook lifecycle and execution.
- [OPIK-2876] Update documentation with an example for customizing HTTPX client in Python SDK
- Added a section describing advanced HTTP client configuration in the SDK documentation.
- Included a Python code example demonstrating custom
httpx.Clienthook usage.
-
[OPIK-2876] Fixed typo and removed unnecessary
globaldeclarations. -
[OPIK-2376] [P SDK] Refactor hooks module for better organization and update deprecation notice
- Moved
httpx_client_hooklogic to a new dedicated module. - Added
__init__.pyfor streamlined imports and to improve package structure.
-
[OPIK-2376] Update
httpx_clientands3_httpx_clientto use proper module path -
[OPIK-2376] Rename
hookandhttpx_client_argumentstoclient_modifierandclient_init_arguments
- Refactored
HttpxClientHookto improve parameter clarity. - Updated tests and documentation to use the new parameter names.
- Ensured consistency across the SDK and unit tests.
下载附件