Skip to content

Commit d5f9a0b

Browse files
authored
Merge pull request #247 from ryanlovett/jupyterhub-3.0.0b1
Quell async warning, and POST with body for jupyterhub 3.0
2 parents c808003 + 75358f3 commit d5f9a0b

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ repos:
5555
# Lint: Checks that non-binary executables have a proper shebang.
5656
- id: check-executables-have-shebangs
5757

58-
5958
# pre-commit.ci config reference: https://pre-commit.ci/#configuration
6059
ci:
6160
autoupdate_schedule: monthly

batchspawner/singleuser.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,31 @@
77
from jupyterhub.utils import random_port, url_path_join
88
from jupyterhub.services.auth import HubAuth
99

10+
import requests
11+
1012

1113
def main(argv=None):
1214
port = random_port()
1315
hub_auth = HubAuth()
1416
hub_auth.client_ca = os.environ.get("JUPYTERHUB_SSL_CLIENT_CA", "")
1517
hub_auth.certfile = os.environ.get("JUPYTERHUB_SSL_CERTFILE", "")
1618
hub_auth.keyfile = os.environ.get("JUPYTERHUB_SSL_KEYFILE", "")
17-
hub_auth._api_request(
18-
method="POST",
19-
url=url_path_join(hub_auth.api_url, "batchspawner"),
19+
20+
url = url_path_join(hub_auth.api_url, "batchspawner")
21+
headers = {"Authorization": f"token {hub_auth.api_token}"}
22+
23+
# internal_ssl kwargs
24+
kwargs = {}
25+
if hub_auth.certfile and hub_auth.keyfile:
26+
kwargs["cert"] = (hub_auth.certfile, hub_auth.keyfile)
27+
if hub_auth.client_ca:
28+
kwargs["verify"] = hub_auth.client_ca
29+
30+
r = requests.post(
31+
url,
32+
headers={"Authorization": f"token {hub_auth.api_token}"},
2033
json={"port": port},
34+
**kwargs,
2135
)
2236

2337
cmd_path = which(sys.argv[1])

0 commit comments

Comments
 (0)