|
|
|
|
@ -14,18 +14,10 @@ import sys
|
|
|
|
|
import traceback
|
|
|
|
|
import types
|
|
|
|
|
import warnings
|
|
|
|
|
try:
|
|
|
|
|
# py3
|
|
|
|
|
from http.client import responses
|
|
|
|
|
from http.cookies import Morsel
|
|
|
|
|
except ImportError:
|
|
|
|
|
from httplib import responses
|
|
|
|
|
from Cookie import Morsel
|
|
|
|
|
try:
|
|
|
|
|
from urllib.parse import urlparse # Py 3
|
|
|
|
|
except ImportError:
|
|
|
|
|
from urlparse import urlparse # Py 2
|
|
|
|
|
from http.client import responses
|
|
|
|
|
from http.cookies import Morsel
|
|
|
|
|
|
|
|
|
|
from urllib.parse import urlparse
|
|
|
|
|
from jinja2 import TemplateNotFound
|
|
|
|
|
from tornado import web, gen, escape, httputil
|
|
|
|
|
from tornado.log import app_log
|
|
|
|
|
@ -35,7 +27,7 @@ from notebook._sysinfo import get_sys_info
|
|
|
|
|
|
|
|
|
|
from traitlets.config import Application
|
|
|
|
|
from ipython_genutils.path import filefind
|
|
|
|
|
from ipython_genutils.py3compat import string_types, PY3
|
|
|
|
|
from ipython_genutils.py3compat import string_types
|
|
|
|
|
|
|
|
|
|
import notebook
|
|
|
|
|
from notebook._tz import utcnow
|
|
|
|
|
@ -479,10 +471,6 @@ class IPythonHandler(AuthenticatedHandler):
|
|
|
|
|
if host.startswith('[') and host.endswith(']'):
|
|
|
|
|
host = host[1:-1]
|
|
|
|
|
|
|
|
|
|
if not PY3:
|
|
|
|
|
# ip_address only accepts unicode on Python 2
|
|
|
|
|
host = host.decode('utf8', 'replace')
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
addr = ipaddress.ip_address(host)
|
|
|
|
|
except ValueError:
|
|
|
|
|
|