Conversation
anuraaga
commented
Jan 20, 2026
| cleanup.push_async_exit(transport.__aexit__) | ||
| http_client = Client(transport) | ||
| else: | ||
| http_client = None |
Collaborator
Author
There was a problem hiding this comment.
Added coverage of a client without an explicit transport which could have been good before too
|
|
||
|
|
||
| # Convert a timeout with connect semantics to a httpx.Timeout. Connect timeouts | ||
| # should apply to an entire operation but this is difficult in synchronous Python code |
Collaborator
Author
There was a problem hiding this comment.
With reqwest, the timeout applies from start to end of response read so it works without any weirdness
| final_count = counter["requests"] | ||
|
|
||
| app = HaberdasherASGIApplication(counting_haberdasher()) | ||
| # Use uvicorn since it supports lifespan |
Collaborator
Author
There was a problem hiding this comment.
pyqwest ASGITransport supports lifespan
| assert response.headers == response_headers | ||
|
|
||
|
|
||
| # To exercise timeouts, can't use mock transports |
Collaborator
Author
There was a problem hiding this comment.
Mock transports support timeouts
anuraaga
commented
Jan 20, 2026
| """Close the HTTP client. After closing, the client cannot be used to make requests.""" | ||
| if not self._closed: | ||
| self._closed = True | ||
| if self._close_client: |
Collaborator
Author
There was a problem hiding this comment.
There's nothing left to close. I left he methods though in case we need to add in the future
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
6c6c276 to
b41712a
Compare
stefanvanburen
approved these changes
Jan 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed, this is the spike to replace httpx with pyqwest. Seems like a lot to like here, but of course I'm biased :) Happy to hear what others think.