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

RFC: httpx #237

Closed
wants to merge 18 commits into from
Closed

RFC: httpx #237

wants to merge 18 commits into from

Conversation

hinthornw
Copy link
Collaborator

@hinthornw hinthornw commented Sep 22, 2023

Would love feedback on this. Especially on the following:

  1. Finalizing for the async client (Right now the event loop often fails)
  2. Thoughts on how to reduce code copying.

filter_null_params: bool = True,
) -> httpx.Response:
"""Send a request with retries."""
with _request_error_handler(request_method, url) as handler_state:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on this error handling context manager to reduce duplicate handling code?

k: v for k, v in params.items() if v is not None
}
response = self._client.request(request_method, url, **request_kwargs)
handler_state["response"] = response
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit weird way to add checking of response in the error handling...

return
try:
with concurrent.futures.ThreadPoolExecutor(1) as executor:
executor.submit(lambda: asyncio.run(client.aclose())).result(timeout=10)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may sometime lock if called explicitly in our tests if garbage collection isn't triggered explicitly beforehand (not always but sometimes). I'm not sure why at the moment.

@hinthornw hinthornw closed this Apr 4, 2024
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

Successfully merging this pull request may close these issues.

1 participant