Django Visitor Information Middleware
This module contains a collection of middleware classes which make writing timezone and location aware applications easier.
Information provided by this middleware can be used to do things like:
Display a cookie consent message if visitor is coming from the country within the EU
Display timezone change notification if a user’s location timezone doesn’t match a timezone which is currently set in the profile
…
Installation
pip install django-visitor-information-middleware
Geolocation Database
To determine location information based on the user IP address, this module uses GEO IP database.
By default, it ships with a free GeoLite2 database (http://dev.maxmind.com/geoip/geoip2/geolite2/).
If you want to use a custom database file, simply set VISITOR_INFO_GEOIP_DATABASE_PATH setting to point to your geoip database file. Keep in mind that this file needs to be readable by a process under which your Django application is running.
Included Middleware
TimezoneMiddleware
The middleware activates a timezone for an authenticated user.
VisitorInformationMiddleware
This middleware adds the following keys to the request.visitor dictionary:
country - country the visitor is based in
city - city the visitor is based in
location.timezone - timezone used in the location visitor is based in
location.unit_system - unit system used in the location visitor is based in
user.timezone - timezone of the currently authenticated user
user.unit_system - unit system of the currently authenticated user.
cookie_notice - True if a cookie consent notice should be displayed for the current visitor.
Note: Location of the user is determined based on the user’s IP address.
Changelog
0.1.0 - 2013-10-25
Initial release.
Metadata
Release files for django-visitor-information-middleware 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-visitor-information-middleware-0.1.0.tar.gz | 10.3 MB | Without provenance | Details for django-visitor-information-middleware-0.1.0.tar.gz |
Release files / django-visitor-information-middleware-0.1.0.tar.gz
| Download URL | django-visitor-information-middleware-0.1.0.tar.gz |
|---|---|
| Size | 10.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da7b925225f8e8779ac2a4e61d80c8e1fc168ed75e5fb0f9b4b1490ec2807664
|
|
BLAKE2b-256 checksum How to use checksums |
11f85e431446aff0f1ce100474105ec7cc35a1736e456471c444c145d4e1fcdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-visitor-information-middleware 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.