Reputation: 2430
Is there a way to lookup geolocation data without hitting an external service every time an IP address needs to be checked?
Upvotes: 1
Views: 3279
Reputation: 301
Before I found http://freegeoip.net/json/ I was using another ip lookup (can't remember what it was) and I logged all the results using the first two segments of the IP so I could use it as a reference table when the service I was using went over quota (which seemed to happen quite often)
So I saved the first two octets and the location, then used those to match against and built my own local table.
It may not have been exact but probably close.
So if an IP was 65.55.219.178 I saved
65.55 -> Richmond WA
eventually I had a pretty large local table that covered 90% of my needs.
Upvotes: 1
Reputation:
Maxmind offer downloadable Geo-IP databases, and libraries for a raft of languages )including Python) to query them.
Upvotes: 2