File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 55
55
# Lint: Checks that non-binary executables have a proper shebang.
56
56
- id : check-executables-have-shebangs
57
57
58
-
59
58
# pre-commit.ci config reference: https://pre-commit.ci/#configuration
60
59
ci :
61
60
autoupdate_schedule : monthly
Original file line number Diff line number Diff line change 7
7
from jupyterhub .utils import random_port , url_path_join
8
8
from jupyterhub .services .auth import HubAuth
9
9
10
+ import requests
11
+
10
12
11
13
def main (argv = None ):
12
14
port = random_port ()
13
15
hub_auth = HubAuth ()
14
16
hub_auth .client_ca = os .environ .get ("JUPYTERHUB_SSL_CLIENT_CA" , "" )
15
17
hub_auth .certfile = os .environ .get ("JUPYTERHUB_SSL_CERTFILE" , "" )
16
18
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 } " },
20
33
json = {"port" : port },
34
+ ** kwargs ,
21
35
)
22
36
23
37
cmd_path = which (sys .argv [1 ])
You can’t perform that action at this time.
0 commit comments