Skip to content

afreeorange/ip-to-location

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

IP to Location

An API interface to MaxMind's free GeoIP2 database. Here's what a sample response will look like:

Sample response

Installation

Get the MaxMind database

GEOLITE2_LOCATION='http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz'
wget -O - $GEOLITE2_LOCATION | gunzip - > /tmp/GeoLite2-City.mmdb

Then set an environment variable called $IPL_PATH_TO_GEOIP_DB to the path.

To debug, set $IPL_DEBUG to "True".

In a virtual environment, install the dependencies

pip install -r requirements.txt

Fire it up

gunicorn -b 0.0.0.0:8080 ip_to_location:app

See the ui folder for a simple front end to the app. Add IPs like so

ipl.html?128.255.78.67,122.240.1.5

It looks like this:

UI

License

MIT

About

An API interface to MaxMind's free GeoIP2 database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors