Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ip_address only accepts unicode on Python 2 #3809

Merged
merged 2 commits into from
Aug 13, 2018

Conversation

minrk
Copy link
Member

@minrk minrk commented Jul 31, 2018

ipaddress.ip_address('127.0.0.1') fails with ValueError on Python 2

need to decode it, otherwise 127.0.0.1 won't be treated as local

workaround in the meantime should be to use 'localhost' instead of '127.0.0.1'

closes jupyter/nbdime#408

cc @vidartf

ipaddress.ip_address('127.0.0.1') fails with ValueError on Python 2

need to decode it, otherwise 127.0.0.1 won't be treated as local
so this list isn't empty when these handlers are used outside NotebookApp
try:
addr = ipaddress.ip_address(host)
except ValueError:
# Not an IP address: check against hostnames
allow = host in self.settings.get('local_hostnames', [])
allow = host in self.settings.get('local_hostnames', ['localhost'])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionally, added 'localhost' as the default here so that it is defined by default when used outside NotebookApp, e.g. nbdime.

@minrk minrk added this to the 5.7 milestone Aug 1, 2018
@blink1073
Copy link
Contributor

Thanks!

@blink1073 blink1073 merged commit eed1caf into jupyter:master Aug 13, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to avoid 403: Forbidden Error?
2 participants