Skip to content

Commit 6701ab7

Browse files
committed
Quell async warning, and POST with body.
1 parent d4d6593 commit 6701ab7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

batchspawner/singleuser.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import os
23
import sys
34

@@ -7,17 +8,20 @@
78
from jupyterhub.utils import random_port, url_path_join
89
from jupyterhub.services.auth import HubAuth
910

11+
from tornado.escape import json_encode
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"),
20-
json={"port": port},
19+
asyncio.run(
20+
hub_auth._api_request(
21+
method="POST",
22+
url=url_path_join(hub_auth.api_url, "batchspawner"),
23+
body=json_encode({"port": port})
24+
)
2125
)
2226

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

0 commit comments

Comments
 (0)