-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fix interface compatibility by inheriting from Response
#254
Fix interface compatibility by inheriting from Response
#254
Conversation
Response
Response
Response
skip-checks:true
Thank you for taking the time to work on this. This will take me a little more time to review and test to see if it introduces breaking changes not covered by tests. I have questions about a couple of these changes, and I'm not necessarily disagreeing, but I'd like to understand the rationale:
|
When I read the existing code, I saw use cases for
After the refactoring I found no more applicable cases for the I've read the I will be happy to review your commits that add some |
The |
Alright, let's try it without |
To be clear, what would you like to see as the next step?
|
It looks like there aren't any other issues to address immediately, so I am fine with publishing a new release. I can take care of that after work today. The only other thing I want to check first is updating Sphinx and other doc dependencies, and making sure the docs still render correctly. |
I found a possible issue when testing with python 3.13 alpha: test/integration/base_backend_test.py:113: in get_url
return await mysession.get(url)
.venv/lib/python3.13/site-packages/forge/_revision.py:322: in inner
return await callable(*mapped.args, **mapped.kwargs)
aiohttp_client_cache/session.py:119: in _request
CachedResponse, await super()._request(method, str_or_url, **kwargs)
.venv/lib/python3.13/site-packages/aiohttp/client.py:688: in _request
resp.close()
.venv/lib/python3.13/site-packages/aiohttp/client_reqrep.py:1081: in close
self._notify_content()
.venv/lib/python3.13/site-packages/aiohttp/client_reqrep.py:1156: in _notify_content
content = self.content
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ClientResponse(http://localhost:8080/get?page=499) [None None]>
None
@property
def content(self) -> StreamReader:
> if self._content is None:
E AttributeError: 'CachedResponse' object has no attribute '_content'. Did you mean: 'content'? I couldn't consistently reproduce it, and it only came up when testing concurrent requests. I can't tell exactly why that would happen, but I believe initializing |
These changes have been released in v0.12! |
Closes #251
What
Now
CachedResponse
inherits fromResponse
.Breaking changes
No, but there might be some edge cases that I could overlook.
Small notes
links
attribute. In the old code, we had to redefine all the attributes and properties, but in the new code, we rely on the existing class.CachedStreamReader
was a bit tricky. This is what you may want to review more carefully._loop
), but for real use cases we never need to restore them.try
/except
inaiohttp_client_cache/backends/base.py:158
please read https://github.com/alessio-locatelli/aiohttp-client-cache/pull/1#discussion_r1778760304