Skip to content

Exception thrown using IPV6 address #19

@cosmoJFH

Description

@cosmoJFH

When I tried to get the location for an IPV6,

database = IP2Location.IP2Location()
database.open(os.path.join("data", "IP2LOCATION-LITE-DB1.IPV6.BIN"))
rec = database.get_all('2600:1009:d01f:87d4:0:48:63ee:4601')

the following exception is thrown:

Traceback (most recent call last):
  File "prueba.py", line 77, in <module>
    print(str(IP2LocObj.get_all('2600:1009:d01f:87d4:0:48:63ee:4601')))
  File "anaconda3/lib/python3.7/site-packages/IP2Location-8.7.1-py3.7.egg/IP2Location.py", line 315, in get_all
  File "anaconda3/lib/python3.7/site-packages/IP2Location-8.7.1-py3.7.egg/IP2Location.py", line 546, in _get_record
  File "anaconda3/lib/python3.7/site-packages/IP2Location-8.7.1-py3.7.egg/IP2Location.py", line 477, in _parse_addr
  File "anaconda3/lib/python3.7/site-packages/IP2Location-8.7.1-py3.7.egg/IP2Location.py", line 101, in is_ipv4
ValueError: invalid literal for int() with base 10: '2600:1009:d01f:87d4:0:48:63ee:4601'

The problem is that the method _parse_addr(self, addr) always calls the method is_ipv4(addr).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions