Skip to content

Commit 343c216

Browse files
committed
fix urlparse usage and comment
1 parent 7636f21 commit 343c216

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kernel_gateway/gatewayapp.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def _load_api_module(self, module_name):
349349
return importlib.import_module(module_name)
350350

351351
def _load_notebook(self, uri):
352-
"""Loads a notebook from the local filesystem or HTTP URL.
352+
"""Loads a notebook from the local filesystem or HTTP(S) URL.
353353
354354
Raises
355355
------
@@ -363,9 +363,10 @@ def _load_notebook(self, uri):
363363
"""
364364
parts = urlparse(uri)
365365

366-
if parts.netloc == '' or parts.netloc == 'file':
366+
if parts.scheme not in ('http', 'https'):
367367
# Local file
368-
with open(parts.path) as nb_fh:
368+
path = parts._replace(scheme='', netloc='').geturl()
369+
with open(path) as nb_fh:
369370
notebook = nbformat.read(nb_fh, 4)
370371
else:
371372
# Remote file

0 commit comments

Comments
 (0)