Info: | See github for the latest source. |
---|---|
Author: | Alexandre Fiori <[email protected]> |
This is the software running behind the IP Geolocation Web Service at freegeoip.net.
The database is not shipped with the package. However, there are instructions for downloading and generating a local version of the database, using the database/createdb.py
python script.
The web service can deliver search results in three different formats: CSV, XML and JSON (with callbacks).
For querying GeoIP information (using curl):
curl http://freegeoip.net/csv/google.com curl http://freegeoip.net/xml/69.63.189.16 curl http://freegeoip.net/json/74.200.247.59 curl http://freegeoip.net/json/github.com?callback=doit
For querying GeoIP information about your own IP:
curl http://freegeoip.net/xml/
For querying Timezone information (/tz/
country_code
/region_code
):curl http://freegeoip.net/tz/xml/BR/27 curl http://freegeoip.net/tz/json/US/10 curl http://freegeoip.net/tz/json/CA/10?callback=doit
For development:
export PYTHONPATH=`pwd` twistd -n freegeoip
For production, check out the scripts
directory. There are init scripts for debian - single instance, or multiple instances for multi-core systems. I recommend load balancing with Nginx.
Depends on redis.
I usually use the following in ~/.bash_profile or ~/.bashrc in order to easily query the geoip database from the Unix command line:
# geoip function geoip_curl_xml { curl -D - http://freegeoip.net/xml/$1 } alias geoip=geoip_curl_xml
Check out scripts/test.py.
Thanks to (in no particular order):
google.com
- Because it wouldn't look so good without the map
twitter.com
- Bootstrap makes dirty programmers feel like artists
ipinfodb.com
- For formely providing both GeoIP and Timezones database
maxmind.com
- For creating the database