Metadata-Version: 2.1
Name: django-request-position
Version: 1.0.0
Summary: Django app to add a 'position' field to the request, using GeoIP or GPS data given in the request headers.
Home-page: https://github.com/marcosgabarda/django-request-position
License: MIT
Author: Marcos Gabarda
Author-email: hey@marcosgabarda.com
Requires-Python: >=3.7,<4.0
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Utilities
Requires-Dist: django (>=3.0.0,<4.0.0)
Requires-Dist: geoip2 (>=4.3.0,<5.0.0)
Description-Content-Type: text/x-rst

Django Request Position
=======================

Django app to add a "position" field to the request, using GeoIP or GPS data given in the request headers. Some
references about this:

* `A Uniform Resource Identifier for Geographic Locations ('geo' URI) <http://tools.ietf.org/rfc/rfc5870>`_.
* `HTTP Geolocation draft-thomson-geopriv-http-geolocation-00 <http://tools.ietf.org/html/draft-thomson-geopriv-http-geolocation-00>`_.


Quick start
-----------

**1** Install using pip::

    pip install django-request-position

**2** Add "request_position" to your INSTALLED_APPS settings like this::

    INSTALLED_APPS += ('request_position',)


**3** Add the middleware::

    MIDDLEWARE += (
        'request_position.middleware.RequestPositionMiddleware',
    )


Settings
--------

* ``REQUEST_POSITION_REMOTE_ADDR_ATTR`` (default: "REMOTE_ADDR")
* ``REQUEST_POSITION_DEFAULT_IP`` (default: "127.0.0.1")
* ``REQUEST_POSITION_DEFAULT_POSITION`` (default: None)
* ``REQUEST_POSITION_DEFAULT_COUNTRY_CODE`` (default: None)
* ``REQUEST_POSITION_COOKIE_NAME`` (default: "_request_position")
* ``REQUEST_POSITION_GEO_HEADER`` (default: "HTTP_GEOLOCATION")
* ``REQUEST_POSITION_OVERRIDE_LATITUDE_PARAM`` (default "lat")
* ``REQUEST_POSITION_OVERRIDE_LONGITUDE_PARAM`` (default "lon")
* ``REQUEST_POSITION_OVERRIDE_COUNTRY_CODE_PARAM`` (default "cc")
* ``REQUEST_POSITION_USE_GIS_POINT`` (default False)

