Skip to content

Commit

Permalink
Merge pull request #94 from pv8/feat-handle-httpbin-response
Browse files Browse the repository at this point in the history
Handle new response from httpbin.org/ip
  • Loading branch information
pv8 authored Apr 4, 2019
2 parents 8efdccb + dd25d76 commit 987de09
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion noipy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""

__title__ = "noipy"
__version_info__ = ('1', '5', '1')
__version_info__ = ('1', '5', '2')
__version__ = ".".join(__version_info__)
__author__ = "Pablo O Vieira"
__email__ = "[email protected]"
Expand Down
5 changes: 3 additions & 2 deletions noipy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import requests

HTTPBIN_URL = "http://httpbin.org/ip"
HTTPBIN_URL = "https://httpbin.org/ip"

try:
input = raw_input
Expand All @@ -26,7 +26,8 @@ def get_ip():
"""
try:
r = requests.get(HTTPBIN_URL)
return r.json()['origin'] if r.status_code == 200 else None
ip, _ = r.json()['origin'].split(',')
return ip if r.status_code == 200 else None
except requests.exceptions.ConnectionError:
return None

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ deps =

commands =
python --version
coverage run --source noipy -m pytest {posargs}
coverage run --source noipy -m pytest -s -v {posargs}
coverage report -m

[testenv:pep8]
Expand Down

0 comments on commit 987de09

Please sign in to comment.