Document incompatibility with aiohttp-requests (aiohttp-requests' fault)
AndreaCensi opened this issue · comments
Long story short
The module aiohttp-requests
does some weird monkey patching that causes aiodocker to fail in inscrutable ways when trying to read/write to stdin/stdout using attach().
https://pypi.org/project/aiohttp-requests/
This is the monkey patch that causes problems:
# Patch ClientResponse.read to release immediately after read so we don't need to worry about that / use context manager
_read_only = aiohttp.client_reqrep.ClientResponse.read
async def _read_and_release(self): # noqa
try:
data = await _read_only(self)
finally:
self.close()
return data
aiohttp.client_reqrep.ClientResponse.read = _read_and_release
- Expected behaviour: can read/write to stdin/stdout using
attach()
- Actual behaviour:
stream._init()
fails in inscrutable ways
Suggestion
My suggestion is to document this fact in the documentation. aiohttp-requests
is a popular package.
The problem is subtle because most of aiodocker
works; it's just the attach()
part that doesn't work.