Fix to work with _api_request from Jupyterhub > 3#255
Fix to work with _api_request from Jupyterhub > 3#255rmalouf wants to merge 2 commits intojupyterhub:masterfrom
Conversation
|
Thanks for submitting your first pull request! You are awesome! 🤗 |
for more information, see https://pre-commit.ci
|
Hi, Thank you for posting this. It looks like #250, #251 and this #255 are all trying to solve this same issue. Do you think you could merge your efforts? Would be wonderful to get this merged, since currently a simple "pip install" install fails. It looks like #251 has an attempt at backward-compatibility to earlier JHubs, so maybe that's preferable? |
|
Dang it! Not sure how I missed that, but yes, those are fixes for the same problem and #251 is more general. I'll just close this one. |

After upgrading to Jupyterhub > 3, running batchspawner-singleuser produces the error:
and the singleuser server never makes contact with the jupyterhub server. Issues #233 and #253 may be related to this.
The source of the problem is that Jupyterhub refactored the routines in services.auth to allow them to work with async code. Connected to that, they switched from using requests to tornado.HTTPClient. This was supposed to be a transparent and non-breaking change, but batchspawner-singleuser cheats by calling an internal function (
_api_request) and pays the price!This PR just wraps the call to
_api_requestinasyncio.run()and replaces thejson=arg withbody=.