GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

New issue
Copy link
New issue
Copy link
Closed
#11
Closed
ipinfo return an error (IndexError: tuple index out of range) when details of specific IP address is not available. #10
#11
Copy link
Assignees
UmanShahzad

Description

@dc-aichara
dc-aichara
opened on Mar 13, 2019
Issue body actions

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

  1. coderholic
    assigned
    UmanShahzad
    on Mar 13, 2019
  2. UmanShahzad commented on Mar 13, 2019

    @UmanShahzad
    UmanShahzad
    on Mar 13, 2019
    Contributor
    More actions

    @dc-aichara Hey, we'll check this one out tomorrow! Sorry for any inconvenience.

  3. UmanShahzad commented on Mar 15, 2019

    @UmanShahzad
    UmanShahzad
    on Mar 15, 2019
    Contributor
    More actions

    @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.

  4. dc-aichara commented on Mar 15, 2019

    @dc-aichara
    dc-aichara
    on Mar 15, 2019
    Author
    More actions

    @UmanShahzad Hey! Thank you for fixing bug. Much appreciated. Please, release update.

    Reacted by Uman Shahzad
  5. UmanShahzad commented on Mar 15, 2019

    @UmanShahzad
    UmanShahzad
    on Mar 15, 2019
    Contributor
    More actions

    @dc-aichara Yep will merge and release it ASAP.

    Reacted by Dayal Chand Aichara
  6. UmanShahzad
    closed this as completedin #11on Mar 17, 2019
  7. UmanShahzad commented on Mar 18, 2019

    @UmanShahzad
    UmanShahzad
    on Mar 18, 2019
    Contributor
    More actions

    @dc-aichara It's released!

    Reacted by Dayal Chand Aichara
    Reacted by Dayal Chand Aichara
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @UmanShahzad
    UmanShahzad

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

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.