Skip to content

Commit 70b7ea3

Browse files
Sigmar StefanssonLironavr1bloomsablink1073IITII
authored
Bgd 4393 merge upstream jupyter_server 2.12.4 (#14)
* Create CODEOWNERS * ContentsHandler return 404 rather than raise exc (jupyter-server#1357) * Add more typings (jupyter-server#1356) * Publish 2.10.1 SHA256 hashes: jupyter_server-2.10.1-py3-none-any.whl: 20519e355d951fc5e1b6ac5952854fe7620d0cfb56588fa4efe362a758977ed3 jupyter_server-2.10.1.tar.gz: e6da2657a954a7879eed28cc08e0817b01ffd81d7eab8634660397b55f926472 * Bump to 2.11.0.dev0 * typo: ServerApp (jupyter-server#1361) * Support get file(notebook) md5 (jupyter-server#1363) * Update ruff and typings (jupyter-server#1365) * Update api docs with md5 param (jupyter-server#1364) * Publish 2.11.0 SHA256 hashes: jupyter_server-2.11.0-py3-none-any.whl: c9bd6e6d71dc5a2a25df167dc323422997f14682b008bfecb5d7920a55020ea7 jupyter_server-2.11.0.tar.gz: 78c97ec8049f9062f0151725bc8a1364dfed716646a66819095e0e8a24793eba * Bump to 2.12.0.dev0 * Change md5 to hash and hash_algorithm, fix incompatibility (jupyter-server#1367) Co-authored-by: Frédéric Collonval <[email protected]> * avoid unhandled error on some invalid paths (jupyter-server#1369) * Publish 2.11.1 SHA256 hashes: jupyter_server-2.11.1-py3-none-any.whl: 4b3a16e3ed16fd202588890f10b8ca589bd3e29405d128beb95935f059441373 jupyter_server-2.11.1.tar.gz: fe80bab96493acf5f7d6cd9a1575af8fbd253dc2591aa4d015131a1e03b5799a * Bump to 2.12.0.dev0 * Merge pull request from GHSA-h56g-gq9v-vc8r Co-authored-by: Steven Silvester <[email protected]> * Publish 2.11.2 SHA256 hashes: jupyter_server-2.11.2-py3-none-any.whl: 0c548151b54bcb516ca466ec628f7f021545be137d01b5467877e87f6fff4374 jupyter_server-2.11.2.tar.gz: 0c99f9367b0f24141e527544522430176613f9249849be80504c6d2b955004bb * Bump to 2.12.0.dev0 * chore: update pre-commit hooks (jupyter-server#1370) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Steven Silvester <[email protected]> * Update for tornado 6.4 (jupyter-server#1372) * Support async Authorizers (jupyter-server#1373) * Publish 2.12.0 SHA256 hashes: jupyter_server-2.12.0-py3-none-any.whl: 3482912efa4387bb1edc23ba60531796aff3b6d6a6e93a5810f5719e2bdb48b7 jupyter_server-2.12.0.tar.gz: 9fa74ed3bb931cf33f42b3d9046e2788328ec9e6dcc59d48aa3e0910a491e3e4 * Bump to 2.13.0.dev0 * log extension import time at debug level unless it's actually slow (jupyter-server#1375) * Add support for async Authorizers (part 2) (jupyter-server#1374) * Publish 2.12.1 SHA256 hashes: jupyter_server-2.12.1-py3-none-any.whl: fd030dd7be1ca572e4598203f718df6630c12bd28a599d7f1791c4d7938e1010 jupyter_server-2.12.1.tar.gz: dc77b7dcc5fc0547acba2b2844f01798008667201eea27c6319ff9257d700a6d * Bump to 2.13.0.dev0 * Use ruff docstring-code-format (jupyter-server#1377) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Enable htmlzip and epub on readthedocs (jupyter-server#1379) * Update pre-commit deps (jupyter-server#1380) * Fix a typo in error message (jupyter-server#1381) * Force legacy ws subprotocol when using gateway (jupyter-server#1311) Co-authored-by: Emmanuel Pignot <[email protected]> Co-authored-by: Zachary Sailer <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Zachary Sailer <[email protected]> * Publish 2.12.2 SHA256 hashes: jupyter_server-2.12.2-py3-none-any.whl: abcfa33f98a959f908c8733aa2d9fa0101d26941cbd49b148f4cef4d3046fc61 jupyter_server-2.12.2.tar.gz: 5eae86be15224b5375cdec0c3542ce72ff20f7a25297a2a8166a250bb455a519 * Bump to 2.13.0.dev0 * Fix test param for pytest-xdist (jupyter-server#1382) * Simplify the jupytext downstream test (jupyter-server#1383) * Import User unconditionally (jupyter-server#1384) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Publish 2.12.3 SHA256 hashes: jupyter_server-2.12.3-py3-none-any.whl: 6f85310ea5e6068568a521f079fba99d8d17e4884dd1d602ab0f43b3115204a8 jupyter_server-2.12.3.tar.gz: a1d2d51e497b1a6256c48b6940b0dd49b2553981baf1690077c37792f1fa23a1 * Bump to 2.13.0.dev0 * Fix log arguments for gateway client error (jupyter-server#1385) * Publish 2.12.4 SHA256 hashes: jupyter_server-2.12.4-py3-none-any.whl: a125ae18a60de568f78f55c84dd58759901a18ef279abf0418ac220653ca1320 jupyter_server-2.12.4.tar.gz: 41f4a1e6b912cc24a7c6c694851b37d3d8412b180f43d72315fe422cb2b85cc2 * merge 2.12.4 from upstream * merge 2.12.4 from upstream --------- Co-authored-by: Lironavr1 <[email protected]> Co-authored-by: Sam Bloomquist <[email protected]> Co-authored-by: Steven Silvester <[email protected]> Co-authored-by: blink1073 <[email protected]> Co-authored-by: IITII <[email protected]> Co-authored-by: Zhongsheng Ji <[email protected]> Co-authored-by: Frédéric Collonval <[email protected]> Co-authored-by: Min RK <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Zachary Sailer <[email protected]> Co-authored-by: Zsailer <[email protected]> Co-authored-by: Nicholas Bollweg <[email protected]> Co-authored-by: Michał Krassowski <[email protected]> Co-authored-by: Manu <[email protected]> Co-authored-by: Emmanuel Pignot <[email protected]> Co-authored-by: Zachary Sailer <[email protected]> Co-authored-by: Gonzalo Tornaría <[email protected]> Co-authored-by: Marc Wouts <[email protected]> Co-authored-by: Yuvi Panda <[email protected]>
1 parent 05b122d commit 70b7ea3

20 files changed

+4166
-4082
lines changed

.github/dependabot.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ updates:
55
directory: "/"
66
schedule:
77
interval: "weekly"
8+
groups:
9+
actions:
10+
patterns:
11+
- "*"
812
# Python
913
- package-ecosystem: "pip"
1014
directory: "/"

.github/workflows/downstream.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
123123
with:
124124
package_name: jupytext
125-
test_command: pip install pytest-jupyter[server] gitpython pre-commit && python -m ipykernel install --name jupytext-dev --user && pytest -vv -raXxs -W default --durations 10 --color=yes --ignore=tests/test_doc_files_are_notebooks.py --ignore=tests/test_changelog.py
125+
test_command: pip install pytest-jupyter[server] gitpython pre-commit && python -m ipykernel install --name jupytext-dev --user && pytest -vv -raXxs -W default --durations 10 --color=yes
126126

127127
downstream_check: # This job does nothing and is only used for the branch protection
128128
if: always()

.pre-commit-config.yaml

+5-11
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
- id: trailing-whitespace
2222

2323
- repo: https://github.com/python-jsonschema/check-jsonschema
24-
rev: 0.27.2
24+
rev: 0.27.3
2525
hooks:
2626
- id: check-github-workflows
2727

@@ -33,17 +33,11 @@ repos:
3333
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]
3434

3535
- repo: https://github.com/pre-commit/mirrors-prettier
36-
rev: "v3.1.0"
36+
rev: "v4.0.0-alpha.8"
3737
hooks:
3838
- id: prettier
3939
types_or: [yaml, html, json]
4040

41-
- repo: https://github.com/adamchainz/blacken-docs
42-
rev: "1.16.0"
43-
hooks:
44-
- id: blacken-docs
45-
additional_dependencies: [black==23.7.0]
46-
4741
- repo: https://github.com/codespell-project/codespell
4842
rev: "v2.2.6"
4943
hooks:
@@ -58,7 +52,7 @@ repos:
5852
- id: rst-inline-touching-normal
5953

6054
- repo: https://github.com/pre-commit/mirrors-mypy
61-
rev: "v1.7.1"
55+
rev: "v1.8.0"
6256
hooks:
6357
- id: mypy
6458
files: jupyter_server
@@ -67,7 +61,7 @@ repos:
6761
["traitlets>=5.13", "jupyter_core>=5.5", "jupyter_client>=8.5"]
6862

6963
- repo: https://github.com/astral-sh/ruff-pre-commit
70-
rev: v0.1.6
64+
rev: v0.1.9
7165
hooks:
7266
- id: ruff
7367
types_or: [python, jupyter]
@@ -76,7 +70,7 @@ repos:
7670
types_or: [python, jupyter]
7771

7872
- repo: https://github.com/scientific-python/cookie
79-
rev: "2023.11.17"
73+
rev: "2023.12.21"
8074
hooks:
8175
- id: sp-repo-review
8276
additional_dependencies: ["repo-review[cli]"]

.readthedocs.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ python:
1212
path: .
1313
extra_requirements:
1414
- docs
15+
formats:
16+
- epub
17+
- htmlzip
18+
# TODO: evaluate, see https://github.com/jupyter-server/jupyter_server/issues/1378
19+
# - pdf

CHANGELOG.md

+59-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,65 @@ All notable changes to this project will be documented in this file.
44

55
<!-- <START NEW CHANGELOG ENTRY> -->
66

7+
## 2.12.4
8+
9+
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.12.3...7bb21b45392c889b5c87eb0d1b48662a497ba15a))
10+
11+
### Bugs fixed
12+
13+
- Fix log arguments for gateway client error [#1385](https://github.com/jupyter-server/jupyter_server/pull/1385) ([@minrk](https://github.com/minrk))
14+
15+
### Contributors to this release
16+
17+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2024-01-09&to=2024-01-11&type=c))
18+
19+
[@minrk](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aminrk+updated%3A2024-01-09..2024-01-11&type=Issues)
20+
21+
<!-- <END NEW CHANGELOG ENTRY> -->
22+
23+
## 2.12.3
24+
25+
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.12.2...99b9126853b69aafb700b4c92b50b83b7ca00e32))
26+
27+
### Bugs fixed
28+
29+
- Import User unconditionally [#1384](https://github.com/jupyter-server/jupyter_server/pull/1384) ([@yuvipanda](https://github.com/yuvipanda))
30+
31+
### Maintenance and upkeep improvements
32+
33+
- Simplify the jupytext downstream test [#1383](https://github.com/jupyter-server/jupyter_server/pull/1383) ([@mwouts](https://github.com/mwouts))
34+
- Fix test param for pytest-xdist [#1382](https://github.com/jupyter-server/jupyter_server/pull/1382) ([@tornaria](https://github.com/tornaria))
35+
36+
### Contributors to this release
37+
38+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2024-01-04&to=2024-01-09&type=c))
39+
40+
[@mwouts](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Amwouts+updated%3A2024-01-04..2024-01-09&type=Issues) | [@tornaria](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Atornaria+updated%3A2024-01-04..2024-01-09&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Awelcome+updated%3A2024-01-04..2024-01-09&type=Issues) | [@yuvipanda](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ayuvipanda+updated%3A2024-01-04..2024-01-09&type=Issues)
41+
42+
## 2.12.2
43+
44+
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.12.1...49915685531ce90baae9d2a4d6baa9c533beffcc))
45+
46+
### Bugs fixed
47+
48+
- Fix a typo in error message [#1381](https://github.com/jupyter-server/jupyter_server/pull/1381) ([@krassowski](https://github.com/krassowski))
49+
- Force legacy ws subprotocol when using gateway [#1311](https://github.com/jupyter-server/jupyter_server/pull/1311) ([@epignot](https://github.com/epignot))
50+
51+
### Maintenance and upkeep improvements
52+
53+
- Update pre-commit deps [#1380](https://github.com/jupyter-server/jupyter_server/pull/1380) ([@blink1073](https://github.com/blink1073))
54+
- Use ruff docstring-code-format [#1377](https://github.com/jupyter-server/jupyter_server/pull/1377) ([@blink1073](https://github.com/blink1073))
55+
56+
### Documentation improvements
57+
58+
- Enable htmlzip and epub on readthedocs [#1379](https://github.com/jupyter-server/jupyter_server/pull/1379) ([@bollwyvl](https://github.com/bollwyvl))
59+
60+
### Contributors to this release
61+
62+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2023-12-06&to=2024-01-04&type=c))
63+
64+
[@blink1073](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ablink1073+updated%3A2023-12-06..2024-01-04&type=Issues) | [@bollwyvl](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Abollwyvl+updated%3A2023-12-06..2024-01-04&type=Issues) | [@epignot](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aepignot+updated%3A2023-12-06..2024-01-04&type=Issues) | [@krassowski](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Akrassowski+updated%3A2023-12-06..2024-01-04&type=Issues)
65+
766
## 2.12.1
867

968
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.12.0...a59beb9b7bf3decc00af782821561435f47bbb16))
@@ -19,8 +78,6 @@ All notable changes to this project will be documented in this file.
1978

2079
[@minrk](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aminrk+updated%3A2023-12-05..2023-12-06&type=Issues) | [@Zsailer](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3AZsailer+updated%3A2023-12-05..2023-12-06&type=Issues)
2180

22-
<!-- <END NEW CHANGELOG ENTRY> -->
23-
2481
## 2.12.0
2582

2683
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.11.2...3bd347b6f2ead5897a18c6171db1174eaaf6176d))

CODEOWNERS

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
# These owners will be the default owners for everything in
4+
# the repo. Unless a later match takes precedence,
5+
# “team-big-data” team members will be requested for
6+
# review when someone opens a pull request.
7+
*
8+
@Spotinst/team-big-data

examples/simple/pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ source = "nodejs"
3131
[tool.hatch.build.targets.wheel.shared-data]
3232
"etc/jupyter/jupyter_server_config.d" = "etc/jupyter/jupyter_server_config.d"
3333

34+
[tool.hatch.build.targets.wheel]
35+
packages = ["simple_ext1", "simple_ext2", "simple_ext11"]
36+
3437
[tool.hatch.build.hooks.jupyter-builder]
3538
dependencies = [
3639
"hatch-jupyter-builder>=0.8.2",

jupyter_server/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import List
77

88
# Version string must appear intact for automatic versioning
9-
__version__ = "2.12.1"
9+
__version__ = "2.12.4"
1010

1111
# Build up version_info tuple for backwards compatibility
1212
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"

jupyter_server/auth/security.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def passwd(passphrase=None, algorithm="argon2"):
4141
4242
Examples
4343
--------
44-
>>> passwd('mypassword') # doctest: +ELLIPSIS
44+
>>> passwd("mypassword") # doctest: +ELLIPSIS
4545
'argon2:...'
4646
4747
"""
@@ -93,15 +93,14 @@ def passwd_check(hashed_passphrase, passphrase):
9393
9494
Examples
9595
--------
96-
>>> myhash = passwd('mypassword')
97-
>>> passwd_check(myhash, 'mypassword')
96+
>>> myhash = passwd("mypassword")
97+
>>> passwd_check(myhash, "mypassword")
9898
True
9999
100-
>>> passwd_check(myhash, 'otherpassword')
100+
>>> passwd_check(myhash, "otherpassword")
101101
False
102102
103-
>>> passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a',
104-
... 'mypassword')
103+
>>> passwd_check("sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a", "mypassword")
105104
True
106105
"""
107106
if hashed_passphrase.startswith("argon2:"):

jupyter_server/base/handlers.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from jupyter_server._sysinfo import get_sys_info
3434
from jupyter_server._tz import utcnow
3535
from jupyter_server.auth.decorator import authorized
36+
from jupyter_server.auth.identity import User
3637
from jupyter_server.i18n import combine_translations
3738
from jupyter_server.services.security import csp_report_uri
3839
from jupyter_server.utils import (
@@ -50,7 +51,7 @@
5051
from tornado.concurrent import Future
5152

5253
from jupyter_server.auth.authorizer import Authorizer
53-
from jupyter_server.auth.identity import IdentityProvider, User
54+
from jupyter_server.auth.identity import IdentityProvider
5455
from jupyter_server.serverapp import ServerApp
5556
from jupyter_server.services.config.manager import ConfigManager
5657
from jupyter_server.services.contents.manager import ContentsManager

jupyter_server/gateway/connections.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from tornado.escape import json_decode, url_escape, utf8
1414
from tornado.httpclient import HTTPRequest
1515
from tornado.ioloop import IOLoop
16-
from traitlets import Bool, Instance, Int
16+
from traitlets import Bool, Instance, Int, Unicode
1717

1818
from ..services.kernels.connection.base import BaseKernelWebsocketConnection
1919
from ..utils import url_path_join
@@ -31,6 +31,11 @@ class GatewayWebSocketConnection(BaseKernelWebsocketConnection):
3131

3232
retry = Int(0)
3333

34+
# When opening ws connection to gateway, server already negotiated subprotocol with notebook client.
35+
# Same protocol must be used for client and gateway, so legacy ws subprotocol for client is enforced here.
36+
37+
kernel_ws_protocol = Unicode("", allow_none=True, config=True)
38+
3439
async def connect(self):
3540
"""Connect to the socket."""
3641
# websocket is initialized before connection

jupyter_server/gateway/gateway_client.py

+16-12
Original file line numberDiff line numberDiff line change
@@ -757,22 +757,25 @@ async def _is_retryable(self, method: str, exception: Exception) -> bool:
757757

758758
async def gateway_request(endpoint: str, **kwargs: ty.Any) -> HTTPResponse:
759759
"""Make an async request to kernel gateway endpoint, returns a response"""
760-
kwargs = GatewayClient.instance().load_connection_args(**kwargs)
760+
gateway_client = GatewayClient.instance()
761+
kwargs = gateway_client.load_connection_args(**kwargs)
761762
rhc = RetryableHTTPClient()
762763
try:
763764
response = await rhc.fetch(endpoint, **kwargs)
764-
GatewayClient.instance().emit(
765+
gateway_client.emit(
765766
data={STATUS_KEY: SUCCESS_STATUS, STATUS_CODE_KEY: 200, MESSAGE_KEY: "success"}
766767
)
767768
# Trap a set of common exceptions so that we can inform the user that their Gateway url is incorrect
768769
# or the server is not running.
769770
# NOTE: We do this here since this handler is called during the server's startup and subsequent refreshes
770771
# of the tree view.
771772
except HTTPClientError as e:
772-
GatewayClient.instance().emit(
773+
gateway_client.emit(
773774
data={STATUS_KEY: ERROR_STATUS, STATUS_CODE_KEY: e.code, MESSAGE_KEY: str(e.message)}
774775
)
775-
error_reason = f"Exception while attempting to connect to Gateway server url '{GatewayClient.instance().url}'"
776+
error_reason = (
777+
f"Exception while attempting to connect to Gateway server url '{gateway_client.url}'"
778+
)
776779
error_message = e.message
777780
if e.response:
778781
try:
@@ -788,38 +791,39 @@ async def gateway_request(endpoint: str, **kwargs: ty.Any) -> HTTPResponse:
788791
"Ensure gateway url is valid and the Gateway instance is running.",
789792
) from e
790793
except ConnectionError as e:
791-
GatewayClient.instance().emit(
794+
gateway_client.emit(
792795
data={STATUS_KEY: ERROR_STATUS, STATUS_CODE_KEY: 503, MESSAGE_KEY: str(e)}
793796
)
794797
raise web.HTTPError(
795798
503,
796-
f"ConnectionError was received from Gateway server url '{GatewayClient.instance().url}'. "
799+
f"ConnectionError was received from Gateway server url '{gateway_client.url}'. "
797800
"Check to be sure the Gateway instance is running.",
798801
) from e
799802
except gaierror as e:
800-
GatewayClient.instance().emit(
803+
gateway_client.emit(
801804
data={STATUS_KEY: ERROR_STATUS, STATUS_CODE_KEY: 404, MESSAGE_KEY: str(e)}
802805
)
803806
raise web.HTTPError(
804807
404,
805-
f"The Gateway server specified in the gateway_url '{GatewayClient.instance().url}' doesn't "
808+
f"The Gateway server specified in the gateway_url '{gateway_client.url}' doesn't "
806809
f"appear to be valid. Ensure gateway url is valid and the Gateway instance is running.",
807810
) from e
808811
except Exception as e:
809-
GatewayClient.instance().emit(
812+
gateway_client.emit(
810813
data={STATUS_KEY: ERROR_STATUS, STATUS_CODE_KEY: 505, MESSAGE_KEY: str(e)}
811814
)
812815
logging.getLogger("ServerApp").error(
813-
f"Exception while trying to launch kernel via Gateway URL {GatewayClient.instance().url} , {e}",
816+
"Exception while trying to launch kernel via Gateway URL %s: %s",
817+
gateway_client.url,
814818
e,
815819
)
816820
raise e
817821

818-
if GatewayClient.instance().accept_cookies:
822+
if gateway_client.accept_cookies:
819823
# Update cookies on GatewayClient from server if configured.
820824
cookie_values = response.headers.get("Set-Cookie")
821825
if cookie_values:
822826
cookie: SimpleCookie = SimpleCookie()
823827
cookie.load(cookie_values)
824-
GatewayClient.instance().update_cookies(cookie)
828+
gateway_client.update_cookies(cookie)
825829
return response

0 commit comments

Comments
 (0)