Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document incompatibility with aiohttp-requests (aiohttp-requests' fault) #706

Open
AndreaCensi opened this issue Apr 23, 2022 · 0 comments

Comments

@AndreaCensi
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant