Purpose:
- Always use
**get_httpx_client_kwargs()when creatinghttpx.Clientorhttpx.AsyncClientto ensure correct SSL, proxy, timeouts, and redirects.
Guidance for Copilot:
- When suggesting
httpx.Client(orhttpx.AsyncClient(, include**get_httpx_client_kwargs(). - If the user omits it, suggest the corrected version or insert a warning comment.
Preferred patterns:
import httpx
from uipath._utils._ssl_context import get_httpx_client_kwargs
client = httpx.Client(**get_httpx_client_kwargs())
async_client = httpx.AsyncClient(**get_httpx_client_kwargs())
default_client_kwargs = get_httpx_client_kwargs()
client_kwargs = {
**default_client_kwargs,
"base_url": base_url,
"headers": my_headers,
}
client = httpx.Client(**client_kwargs)
async_client = httpx.AsyncClient(**client_kwargs)Anti-patterns (avoid):
client = httpx.Client() # ❌ Missing **get_httpx_client_kwargs()
async_client = httpx.AsyncClient() # ❌ Missing **get_httpx_client_kwargs()Warning to insert if correction isn’t applied:
# WARNING: Use httpx.Client/AsyncClient with **get_httpx_client_kwargs() for proper SSL/proxy configuration.Reference: