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

Suggestion: Support IP2Location.io API #57

Open
ip2location opened this issue Aug 21, 2023 · 8 comments
Open

Suggestion: Support IP2Location.io API #57

ip2location opened this issue Aug 21, 2023 · 8 comments

Comments

@ip2location
Copy link
Contributor

ip2location commented Aug 21, 2023

We would like to propose support for the IP2Location.io API. It has a free tier upon registration. It is one of the fastest API available in the market right now.

We can also offer PR if it is supported.

@iloveitaly
Copy link
Collaborator

Great, I'd accept a PR for this!

@Liferenko
Copy link

Liferenko commented Mar 20, 2024

Hello!
the other day I connected geoip with IP2location.io. And I bet it was working smooth.
But now logs show this error

** (exit) an exception was raised:
* (ArgumentError) Unknown provider: ':ip2locationio'. Please check your geoip configuration.
(geoip 0.2.8) lib/geoip/lookup.ex:85: GeoIP.Lookup.lookup_url/2
(geoip 0.2.8) lib/geoip/lookup.ex:38: GeoIP.Lookup.get_from_provider/2
(geoip 0.2.8) lib/geoip/lookup.ex:23: GeoIP.Lookup.lookup/1
(* 0.1.0) lib/my_web/check_geolocation.ex:17: MyWeb.Plugs.CheckGeolocation.call/2
(* 0.1.0) MyWeb.Router.app/2

my configs are pretty straightforward:

#mix.exs
     {:geoip, "~> 0.2"}


#config/config.ex
config :geoip, provider: :ip2locationio, api_key: "63A**************2E*R*************4"

looks odd, because I clearly can see :ip2locationio as a provider in lookup_url/2.
Need to temporarily switch to :ipinfo

@ip2location
Copy link
Contributor Author

Hi @Liferenko,

If you change the line in mix.exs to {:geoip, git: "https://github.com/navinpeiris/geoip.git"}, does the issue gone? We are able to run the plugin by using this config in dependency.

@wingchen
Copy link

wingchen commented Aug 6, 2024

I still got this, just FYI:

** (exit) an exception was raised:
    ** (ArgumentError) Unknown provider: ':ip2locationio'. Please check your geoip configuration.
        (geoip 0.2.7) lib/geoip/lookup.ex:86: GeoIP.Lookup.lookup_url/2
        (geoip 0.2.7) lib/geoip/lookup.ex:38: GeoIP.Lookup.get_from_provider/2
        (geoip 0.2.7) lib/geoip/lookup.ex:23: GeoIP.Lookup.lookup/1

@ip2location
Copy link
Contributor Author

Hi @wingchen ,

Can you let us know the content of your mix.exs file? We would like to see if we can reproduce the same issue using the same content of the file.

@wingchen
Copy link

wingchen commented Aug 6, 2024

I was using the master branch from this repo:

      # geo
      {:geoip, git: "https://github.com/navinpeiris/geoip.git"},

I looked into the source code. I could not understand it either. lookup.ex looks fine from my perspective at: https://github.com/navinpeiris/geoip/blob/master/lib/geoip/lookup.ex#L84-L86

I just forked it out and I will play with it a bit.

@wingchen
Copy link

wingchen commented Aug 6, 2024

@ip2location my elixir 1.13.0 (I know it's old, we will update it soon) seems to like this style of functions better:
c30aed8

do you want me to create a PR for it? I will update the rest of the providers too.

@ip2location
Copy link
Contributor Author

Hi wingchen,

Sure, you can always create the PR, thanks for your effort!

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

No branches or pull requests

4 participants