Skip to content

Commit 987de09

Browse files
authored
Merge pull request #94 from pv8/feat-handle-httpbin-response
Handle new response from httpbin.org/ip
2 parents 8efdccb + dd25d76 commit 987de09

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

noipy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010

1111
__title__ = "noipy"
12-
__version_info__ = ('1', '5', '1')
12+
__version_info__ = ('1', '5', '2')
1313
__version__ = ".".join(__version_info__)
1414
__author__ = "Pablo O Vieira"
1515
__email__ = "noipy@pv8.io"

noipy/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import requests
1111

12-
HTTPBIN_URL = "http://httpbin.org/ip"
12+
HTTPBIN_URL = "https://httpbin.org/ip"
1313

1414
try:
1515
input = raw_input
@@ -26,7 +26,8 @@ def get_ip():
2626
"""
2727
try:
2828
r = requests.get(HTTPBIN_URL)
29-
return r.json()['origin'] if r.status_code == 200 else None
29+
ip, _ = r.json()['origin'].split(',')
30+
return ip if r.status_code == 200 else None
3031
except requests.exceptions.ConnectionError:
3132
return None
3233

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ deps =
99

1010
commands =
1111
python --version
12-
coverage run --source noipy -m pytest {posargs}
12+
coverage run --source noipy -m pytest -s -v {posargs}
1313
coverage report -m
1414

1515
[testenv:pep8]

0 commit comments

Comments
 (0)