1

I have an old project in python : Get the IP corresponding to a location. I know we can get IP from a location (I've read this), and I would like to know if it's possible to reverse the process.

Here's the idea I had:

•Using the method given in the link, and a "for", to test a large range of IP until we get the wanted location. With some filters I hope we can reduce the amount of IP to test. => Long, and not very efficient

•Exploring the database given here, but I don't know how

Does it's possible ? If yes, what's the best solution for you ?

Thanks for your help :)

Community
  • 1
  • 1
  • 1
    Given that there may be *millions* of IPs at any given "location", I'd first ask you to clarify what "the" IP is expected to be. – deceze Jun 26 '15 at 11:50
  • You'r Right. I would like to get the location corresponding to a public ip (given [by this site](http://whatismyipaddress.com) for eg.). This site can give a location with the IP (for me 78.245.240.*** ) and it's accurate. – Merlin Dupuy Jun 26 '15 at 12:20
  • Now I'm confused. You want to get a location corresponding to an IP address? Or you want to get the *reverse*, the IP at a given location...?! – deceze Jun 26 '15 at 12:26
  • Sorry, I'm not english-native so... I mean the IP at a given location – Merlin Dupuy Jun 26 '15 at 12:30
  • 1
    So you give it something like "Sheffield, England" and you expect "1.2.3.4" as response...? – deceze Jun 26 '15 at 12:31
  • Yes, something like this – Merlin Dupuy Jun 26 '15 at 16:56
  • So, for many locations you'd get a list of some thousand IP addresses. Is that what you want? – deceze Jun 26 '15 at 17:47

1 Answers1

0

There are Python bindings for the GeoIP library.

Also their databases are downloadable.

Here there are some examples in Python. Your use case seems that is not covered. You may have to manually open and search their databases.

fferri
  • 16,928
  • 4
  • 40
  • 82