You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting same error on 8.7.3 which seems to be the latest. 8.7.2 works fine for me
from IP2Location import IP2Location
IP2Location(filename="db11.bin").get_all('2806:2f0:9180:8eec:f026:f24c:8a97:e6a2')
Traceback (most recent call last):
File "/home/disposer/work/regula/v2-licensing-portal/src/tests/local/ip2location_test.py", line 3, in <module>
IP2Location(filename="db11.bin").get_all('2806:2f0:9180:8eec:f026:f24c:8a97:e6a2')
File "/home/disposer/.cache/pypoetry/virtualenvs/app-dJLMS_bJ-py3.8/lib/python3.8/site-packages/IP2Location.py", line 315, in get_all
return self._get_record(addr)
File "/home/disposer/.cache/pypoetry/virtualenvs/app-dJLMS_bJ-py3.8/lib/python3.8/site-packages/IP2Location.py", line 546, in _get_record
ipv, ipnum = self._parse_addr(ip)
File "/home/disposer/.cache/pypoetry/virtualenvs/app-dJLMS_bJ-py3.8/lib/python3.8/site-packages/IP2Location.py", line 477, in _parse_addr
if is_ipv4(addr) == 4 and '256' not in addr:
File "/home/disposer/.cache/pypoetry/virtualenvs/app-dJLMS_bJ-py3.8/lib/python3.8/site-packages/IP2Location.py", line 101, in is_ipv4
if int(ip_parts[i]) > 255:
ValueError: invalid literal for int() with base 10: '2806:2f0:9180:8eec:f026:f24c:8a97:e6a2'
def is_ipv4(hostname):
ip_parts = hostname.split('.')
for i in range(0,len(ip_parts)):
if int(ip_parts[i]) > 255:
return False
pattern = r'^([0-9]{1,3}[.]){3}[0-9]{1,3}$'
if match(pattern, hostname) is not None:
return 4
return False
Getting Same error due to bug in is_ipv4 function,
In previous version
def is_ipv4(hostname):
pattern = r'^([0-9]{1,3}[.]){3}[0-9]{1,3}$'
ip_parts = hostname.split('.')
if match(pattern, hostname) is not None:
ip_parts = hostname.split('.')
for i in range(0,len(ip_parts)):
if int(ip_parts[i]) > 255:
return False
return 4
return False
Getting same error on 8.7.3 which seems to be the latest. 8.7.2 works fine for me
Originally posted by @KirylKovaliov in #19 (comment)
The text was updated successfully, but these errors were encountered: