Migrate to pyqwest by anuraaga · Pull Request #88 · connectrpc/connect-python
| cleanup.push_async_exit(transport.__aexit__) | ||
| http_client = Client(transport) | ||
| else: | ||
| http_client = None |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyqwest ASGITransport supports lifespan
| assert response.headers == response_headers | ||
|
|
||
|
|
||
| # To exercise timeouts, can't use mock transports |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mock transports support timeouts