user225312 user225312 - 1 month ago 13
Python Question

Tracing an IP address in Python

For a college project for my course on Introduction to Programming, I decided to make a small software that traces the IP address and puts them nicely on a GUI (PyQt). Not a big deal I know, but still I like the idea.

So I Googled around and found MaxMind's IP and their free offering and the pygeoip, which is an API for the MaxMind GeoIP databases. Pretty cool, eh!

But the downside is that to query their database, I have to download individual databases for country city. This is not good cause I have to make the end user download additional files (in MBs) just to look up an IP address.

So I am wondering, is there another method of doing this? How do I trace IP addresses? Note that I need them down to the city level, if possible. Something like this guy aruljohn.com/track.pl

Thanks!

Answer

I would have preferred "pygeoip", because it allows you to develop a complete solution locally. Of course, you will need to keep the database.

If you do not want to keep the database locally, you will have to depend on an external service to query for location of an IP. This will keep your solution small but dependent on this service.

For this check out: ipinfodb.com

They provide JSON and XML APIs interface which should be sufficiently easy to build.

Check out more information at : http://ipinfo.info/html/geolocation_2.php