Simple WSGI app that shows your IP and geolocation info.
Uses WorldIP database from http://www.wipmania.com/
- Download worldip.sql.zip (SQL-format DB) from http://www.wipmania.com/en/base/
- Run ./wip2sqlite.sh. This will create worldip.db SQLite DB file. Alternatively run ./wip2pgsql.sh to create tables in PostgreSQL database named worldip (the database must already exist before running this script).
- Set up worldip.py to be served by mod_wsgi or uWSGI (or whatever you use for WSGI apps). You may need to install the dependencies (listed in requirements.txt pip requirements file) in virtualenv or somewhere in PYTHONPATH. By default it looks for SQLite DB, if you intend to use PostgreSQL, change DB URI at the end of the file.
Human readable (text/plain MIME type) response:
$ curl http://example.org/
$ curl -H 'Accept: application/json' http://example.org/
YAML response (text/x-yaml MIME type is also accepted):
$ curl -H 'Accept: application/x-yaml' http://example.org/
$ curl http://example.org/?callback=foobar