You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using FastAPI on Python 3.11 that by default installs uvloop (not asyncio's event-loop). uvloop's underlying_transport doesn't have_start_tls_compatible attribute, but it does have start_tls.
In order to make this code work with proxy I have to do monkey-patch:
importaiohttp# monkey-patch# Save the original ClientSession classOriginalClientSession=aiohttp.ClientSession# Define a patched ClientSession that forces the proxyclassPatchedClientSession(OriginalClientSession):
def__init__(self, *args, **kwargs):
# Always set trust_env=True to honor proxy environment variableskwargs['trust_env'] =Truesuper().__init__(*args, **kwargs)
# Apply the patchaiohttp.ClientSession=PatchedClientSession
Again, I can't change the code above, it is not under my control. Why trust_env has False as default value in the first place? httpx, requests has True by default.
Describe the bug
See also #10676
I'm using Fiddler as local Proxy Server
This code is in some 3rd-party library:
.env
I'm using FastAPI on Python 3.11 that by default installs uvloop (not asyncio's event-loop). uvloop's underlying_transport doesn't have
_start_tls_compatible
attribute, but it does havestart_tls
.In order to make this code work with proxy I have to do monkey-patch:
Again, I can't change the code above, it is not under my control. Why
trust_env
has False as default value in the first place?httpx
,requests
has True by default.Python Version
aiohttp Version
multidict Version
propcache Version
yarl Version
OS
python:3.11-slim
Related component
Client
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: