fastapi service example

This commit is contained in:
Kafonek, Matt
2021-04-07 01:55:43 +00:00
parent c5bfd28005
commit 56269f0226
9 changed files with 318 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import os
import httpx
### For consideration: turn this into a class with
### feature parity for HubAuth, or even subclass HubAuth?
### See jupyterhub.services.auth.HubAuth for details
def get_client():
base_url = os.environ["JUPYTERHUB_API_URL"]
token = os.environ["JUPYTERHUB_API_TOKEN"]
headers = {"Authorization": "Bearer %s" % token}
return httpx.AsyncClient(base_url=base_url, headers=headers)