Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IP2Location.io API #97

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ip2location
Copy link

This PR reflected the issue #95. It features 2 updates:

  • Add a failover for ipapi.co to use IP2Location.io keyless API if the ipapi.co returned HTTP error code 429 (Refers to their doc for more information)
  • Add IP2Location.io API which required an API key. If user setup IP2Location.io API key, it will used it to call IP2Location.io API instead of ipapi.co. And also added the steps to add API key in README.md too.

Please let us know if any changes required for this PR. Hope to see the PR gets approved.

- Added the use of IP2Location.io API.
- Added the http_code variable to detect any HTTP error code from both APIs.
- Added description for IP2Location.io API and the steps to add the API key.
@ArneTR
Copy link
Member

ArneTR commented Nov 1, 2024

Hey, sry for the delay on this.

I had a look at the PR and the integration looks partially usable.

You ripped out the alternative vendor, which was not our intention. We would still like to have it as a fallback.

Can you still integrate that? If not please direct the commit to another branch (ip2location) for instance and I will adapt the PR from our side so that your contribution does not get lost.

  1. The accuracy of your API seems a bit off to the other vendors we are using. I am currently in Berlin with IP 2003:cd:ef14:8901:79e8:bab3:4384:fac5
    and this is the result I get:
Screenshot 2024-11-01 at 10 00 08 AM

Maxmind and ipapi.co deliver Berlin as a result. Can you tell why this inaccuracy happens?

@abdullahdevrel
Copy link

@ArneTR Can you check ipinfo.io for your IP geolocation?

I have a feature request issue here: #96

Added another flag to make sure only use IP2Location.io API if the flag is on and API key is not empty.
Added info for USE_IP2LOCATION_API  variable.
@ip2location
Copy link
Author

Hi @ArneTR,

  1. We had added a new flag called USE_IP2LOCATION_API to ensure that user will only be able to use our API if the flag is set to true. If the flag is not set or set to any value other than true, and the IP2LOCATIONIO_API_KEY is not set, the script will fallback to the ipapi.co as the default API.
  2. We regret that we did not get your results correctly. We will fix it in the next release. The IP geolocation is not 100% accurate for Germany. You can visit this link for more information about the accuracy of IP geolocation results in IP2Location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants