Skip to main content

Flask-Geo

Geolocation for Flask using Maxmind.

Installation

pip install flask-geo

Usage

Initialize the extension:

from flask import Flask
from flask_geo import Geolocation

app = Flask(__name__)
geo = Geolocation(app)

Download a maxmind db:

flask download-geo-db --license-key=XXX

Get the country or city of the visitor:

from flask_geo import geolocate_country, geolocate_city

@app.route("/")
def index():
    country_iso_code = geolocate_country()
    # or
    city_name, country_iso_code = geolocate_city()

Configuration

Config key Extension argument Description Default
FLASK_GEO_MAXMIND_DB maxmind_db Filename towards the maxmind db GeoLite2-City.mmdb
FLASK_GEO_USE_CITY_DB is_city_db Whether it is the city db or the country db True
FLASK_GEO_SILENT silent Do not raise any errors whether the db is missing or geolocation fails True

Metadata

Release files for flask-geo 0.1.0

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-geo 0.1.0
File Size Uploaded Provenance Actions
flask_geo-0.1.0.tar.gz 3.5 kB Without provenance Details for flask_geo-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flask-geo 0.1.0
File Interpreter ABI Platform Actions
flask_geo-0.1.0-py3-none-any.whl Python 3 none any Details for flask_geo-0.1.0-py3-none-any.whl

Total release size: 7.4 kB

Release files / flask_geo-0.1.0.tar.gz

Download URL flask_geo-0.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
006573c8fbcc4866f288fff862e88a11f486ee38476d26a9b693ccfe8a6063c3
BLAKE2b-256 checksum
How to use checksums
53d94932fb0aa8fa6e644353f06802199eb9532f21049a2dc8083c7c81f44193
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-40-generic

Release files / flask_geo-0.1.0-py3-none-any.whl

Download URL flask_geo-0.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad7231fea6d7fd6c78a4919c5f544d183ef0970942595ed5f5fd652d2e65e843
BLAKE2b-256 checksum
How to use checksums
19cbf6b07eee9f3f2400e8c8f1e5ce9766b9e65ccfe1b03fcc718a95e2acf524
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-40-generic

Security for flask-geo 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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