[python] Support proxy_ssl_context for the urllib3-based client

Merged
EM
3mo ago
+166-13

Description

Adds Configuration.proxy_ssl_context (default None, no behavior change) so callers can supply an SSL context used only for the TLS handshake with an HTTPS proxy, independent of the destination TLS settings. This maps directly to urllib3's own proxy_ssl_context support in ProxyManager.

Applies to the python (urllib3 library) and python-pydantic-v1 generators. Not applicable to the SOCKS proxy path (no TLS handshake against a SOCKS proxy) or to the aiohttp-based async client (doesn't use urllib3's ProxyManager).

Context: came up in kubernetes-client/python#2658, where this was requested to live in the upstream generator rather than as a post-processing patch downstream.

cc @cbornet @tomplus @krjakbrjak @fa0311 (Python technical committee)

PR checklist

  • Read the contribution guidelines.
  • Ran ./mvnw clean package, ./bin/generate-samples.sh ./bin/configs/python*.yaml, and ./bin/utils/export_docs_generators.sh (no doc diff, since this isn't a CLI/codegen option). All changed samples are committed.
  • Mentioned the Python technical committee above.

Summary by cubic

Adds Configuration.proxy_ssl_context to the urllib3 Python client and forwards it to ProxyManager for HTTPS proxy TLS handshakes.

Defaults to None; only applies to urllib3 (not SOCKS/aiohttp/tornado); fixes Configuration.__deepcopy__ for ssl.SSLContext while preserving generator behavior; bumps python-pydantic-v1 urllib3 floor to >=1.26.0.