Replace httpx usage in synchronous OptimadeClient
with requests
#1536
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.
Bit of a last minute patch before the tutorials... it seems like we don't handle the case of getting IP banned from an API (which may well happen!) when the client is in non-async mode --- fix this for now by adding a very general exception handler to the request.
ALSO: client hangs even in sync mode within Jupyter notebooks.
The cause of this is that at some point httpx removed support for non-async code altogether, even in the sync client. The fix is to just defer to
requests
at this point. That is what is implemented in this PR, which now allows the client to be properly used within Jupyter/Colab.Unfortunately I am going to have to merge and release without a review, given that the tutorial is in about 12 hours... I'm pretty confident that this is working well though and I was able to update the testing harness with only a couple of lines.
Closes #1527 and closes #1195 (for now -- async still doesn't work inside a jupyter notebook but at least it now runs).