Skip to main content
**Author:** Jacob Magnusson. [Follow me on Twitter](https://twitter.com/jacobsvante_)

## About

This is a simple Flask extension for pygeoip. Not yet thoroughly tested, but has been working great for me so far.


## Installation

Install using `pip`...

pip install Flask-GeoIP

...or clone the project from github.

git clone https://github.com/jmagnusson/Flask-GeoIP.git


## Configuration


The GeoIP file that you want to use needs to be set in your config:

GEOIP_FILEPATH = '/path/to/geoip.dat'

You can change the caching method (default is 'STANDARD') that is used
by pygeoip:

GEOIP_CACHE = 'MEMORY_CACHE'

Then in the code you do:

from flask.ext.geoip import GeoIP
app = Flask(__name__)
app.config.from_pyfile('/path/to/myconfig.py')
geoip = GeoIP(app)
country = geoip.country_name_by_addr('1.2.3.4')

Or if using a factory function for creating your app:

from flask.ext.geoip import GeoIP
geoip = GeoIP()
...
app = create_app('/path/to/myconfig.py')
geoip.init_app(app)
country = geoip.country_name_by_addr('1.2.3.4')


## Documentation

This readme.


## Credits

Thanks go out to [maxmind](https://github.com/maxmind/geoip-api-c) and [appliedsec](https://github.com/appliedsec/pygeoip) for making these great libs.

Metadata

Release files for Flask-GeoIP 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-GeoIP 0.1.3
File Size Uploaded
Flask-GeoIP-0.1.3.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Flask-GeoIP 0.1.3
File Interpreter ABI Platform
Flask_GeoIP-0.1.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 9.5 kB

Release files / Flask-GeoIP-0.1.3.tar.gz

Download URL Flask-GeoIP-0.1.3.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2ec7a96e330b872178fa82c3f433bc96b63b384af429253c7b1d180fc3672a0a
BLAKE2b-256 checksum
How to use checksums
e067ba5551f2e5a12c1d687e0ad8840eac5c4fba23cd1fe4e03e786081017f72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Flask_GeoIP-0.1.3-py2.py3-none-any.whl

Download URL Flask_GeoIP-0.1.3-py2.py3-none-any.whl
Size 5.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3567ba970b2a5c013953a965d3d88f955983955c65f3e9af12c9e5c28a218abe
BLAKE2b-256 checksum
How to use checksums
4255f172aff8e9969ede5c0fa5d8e16f5275c2885477e1c36c8d30569f34c3f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page