Description
The library=asyncio Python template builds aiohttp.ClientSession inline inside RESTClientObject.request(), which leaves no clean extension point for downstream consumers who want to customize the session (e.g. to inject trace_configs for tracing/instrumentation).
By contrast, library=httpx already exposes _create_pool_manager() as a separate method that can be overridden in a subclass.
Request
Bring the asyncio template to parity with httpx by either:
-
Extracting the ClientSession construction into a _create_pool_manager(self) -> aiohttp.ClientSession method (preferred, matches the httpx template); and/or
-
Plumbing a trace_configs field on Configuration (similar to how retries is already exposed) and forwarding it to ClientSession(...).
Either change is small and unblocks attaching custom aiohttp.TraceConfig instances without having to patch generated code after every regeneration.
Version
7.22.0
Reference
python/httpx/rest.mustache already has _create_pool_manager() — asyncio template would mirror that shape.
Description
The
library=asyncioPython template buildsaiohttp.ClientSessioninline insideRESTClientObject.request(), which leaves no clean extension point for downstream consumers who want to customize the session (e.g. to injecttrace_configsfor tracing/instrumentation).By contrast,
library=httpxalready exposes_create_pool_manager()as a separate method that can be overridden in a subclass.Request
Bring the asyncio template to parity with httpx by either:
Extracting the
ClientSessionconstruction into a_create_pool_manager(self) -> aiohttp.ClientSessionmethod (preferred, matches the httpx template); and/orPlumbing a
trace_configsfield onConfiguration(similar to howretriesis already exposed) and forwarding it toClientSession(...).Either change is small and unblocks attaching custom
aiohttp.TraceConfiginstances without having to patch generated code after every regeneration.Version
7.22.0
Reference
python/httpx/rest.mustachealready has_create_pool_manager()— asyncio template would mirror that shape.