Skip to main content

The simplest possible way to get IP geolocation information.

Project description

The simplest possible way to get IP geolocation information in Python. python-simple-geoip Release python-simple-geoip Build



To use this library, you’ll need to create a free GeoIPify account:

If you haven’t done this yet, please do so now.


To install simple-geoip using pypi, simply run:

$ pip install simple-geoip

In the root of your project directory.


Once you have simple-geoip installed, you can use it to easily find the physical location of a given IP address.

This library gives you access to all sorts of geographical location data that you can use in your application in any number of ways.

from simple_geoip import GeoIP

geoip = GeoIP("your-api-key");

    data = geoip.lookup("")
except ConnectionError:
    # If you get here, it means you were unable to reach the geoipify
    # service, most likely because of a network error on your end.
except ServiceError:
    # If you get here, it means geoipify is having issues, so the request
    # couldn't be completed :(
    # Something else happened (non-geoipify) related. Maybe you hit CTRL-C
    # while the program was running, the kernel is killing your process, or
    # something else all together.


Here’s the sort of data you might get back when performing a geoip lookup request:

  "ip": "",
  "location": {
    "country": "US",
    "region": "California",
    "city": "Mountain View",
    "lat": 37.40599,
    "lng": -122.078514,
    "postalCode": "94043",
    "timezone": "-08:00"

By default, this library handles retrying failed HTTP requests for you. For instance: if the GeoIPify API service is currently down or having issues, your request will be retried up to three consecutive times before failing.


All library changes in descending order.

Version 0.1.1

August 4, 2020

WhoisXML API Tech Support has fixed issues due to obsolete commands. It is now Python 3.8 compatible, and has been also tested with Python 3.6 and 2.7.

Version 0.1.0

Released April 26, 2018.

  • First release!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple-geoip-0.1.1.tar.gz (5.2 kB view hashes)

Uploaded source

Built Distribution

simple_geoip-0.1.1-py3-none-any.whl (5.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page