GeezerVison is showing github.com — ipinfo return an error (IndexError: tuple index out of range) when details of specific IP address is not available. · Issue #10 · ipinfo/python
ipinfo return an error (IndexError: tuple index out of range) when details of specific IP address is not available. #10
Description
I am getting IndexError for following code
import ipinfo
access_token = '************'
handler = ipinfo.getHandler(access_token)
ip_country = lambda x:handler.getDetails(x).country
df1['country'] = df1["IP_address"].apply(ip_country)
There are few IP address for which it gives IndexError. For Example : 192.168.73.231, 10.62.100.139
If we try handler.getDetails('10.62.100.139').country, it will retrun IndexError:tuple index out of range.
Can you edit ipinfo package that it return NAN in such cases?
Activity
UmanShahzad commented on Mar 13, 2019
@dc-aichara Hey, we'll check this one out tomorrow! Sorry for any inconvenience.
UmanShahzad commented on Mar 15, 2019
@dc-aichara So the issue is that those IPs are designated as private IPs, and can never have a definitive location. What that also means is you'll get a AttributeError if you try to reference a field that doesn't exist for private IPs, like the country.
So I've opened #11 for fixing the IndexError that happens within the library, but consumers will need to ensure they handle private IPs properly.
dc-aichara commented on Mar 15, 2019
@UmanShahzad Hey! Thank you for fixing bug. Much appreciated. Please, release update.
UmanShahzad commented on Mar 15, 2019
Reacted by Dayal Chand Aichara
UmanShahzad commented on Mar 18, 2019
Reacted by Dayal Chand Aichara
Reacted by Dayal Chand Aichara
Metadata
Metadata
Development
No branches or pull requestsIssue actions