Skip to main content

Get visitor geoip information from the request.

Project description

GeoIp info for your visitors
============================

This simple plugin connects to the `infoip <https://www.infoip.io>`__
API and retrieves the geoip information for the current request/visitor.
It works based on view decorators and not middleware to prevent slowing
down your application with unnecessary data.

The plugin uses an external API which is battle-tested and
enterprise-ready to satisfy any number of requests. Our database is
refreshed every single day in order to respond with up-to-date
information. The API offers ``1000`` free requests every day with a
rate-limiter set at ``1rps`` (one request per second). If you find that
to be too restrictive please consider subscribing to a `premium
plan <https://www.infoip.io/pricing>`__

Supported frameworks
~~~~~~~~~~~~~~~~~~~~

1. Django

Quick start Django
------------------

1. Install the package from pip

``pip install infoip``

2. Import the view decorator and use it to decorate the view where you
need geoip info

.. code:: python

# django test view that simply prints the geoip data regarding the visitor

from infoip.django import infoip
from django.http import JsonResponse

@infoip
def index(request):
# will respond to the request with user info
# you can also use the geoip data in your views for custom processing:
# - request.infoip.country_long
# - request.infoip.country_short
# - ...
return JsonResponse(request.infoip)

3. Tweak the settings

1. (optional) Add your api key to your settings if you are a premium
subscriber of `infoip <https://www.infoip.io>`__

.. code:: python

INFOIP_API_KEY = "your-api-key"

2. (optional) Use ``https`` for communicating with our API (it uses
``http`` by default)

.. code:: python

INFOIP_USE_HTTPS = True

You want to help and contribute? Perfect!
=========================================

These are some contribution examples
------------------------------------

- Reporting issues to the bugtracker.

- Submitting pull requests from a forked infoip repo.

- Extending the documentation.


For pull requests, keep this in mind
------------------------------------

- Add a test which proves your fix and make it pass.

- Describe your change in CHANGES.rst

- Add yourself to the docs/credits.rst





Project details


Download files

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

Source Distribution

infoip-0.1.8.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infoip-0.1.8-py2-none-any.whl (6.5 kB view details)

Uploaded Python 2

File details

Details for the file infoip-0.1.8.tar.gz.

File metadata

  • Download URL: infoip-0.1.8.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for infoip-0.1.8.tar.gz
Algorithm Hash digest
SHA256 9cafcf60db11c73735c6548e86963b1d85894ff72b2c8551c085db8f5eb29b25
MD5 f12628bb339bf6e046875efbd8fac335
BLAKE2b-256 46f6773cbab73efa49241484cb751741b76abb0fa23d06df13b3ab5bf526ca04

See more details on using hashes here.

File details

Details for the file infoip-0.1.8-py2-none-any.whl.

File metadata

File hashes

Hashes for infoip-0.1.8-py2-none-any.whl
Algorithm Hash digest
SHA256 7da5f2e42d77346e80e313936b8c6c6d89524f958c80986604a7393f06f64907
MD5 5d4969e8611b5fa459f85a40cc669906
BLAKE2b-256 7ed4cc34f5af010ace02dfc29dfb9a398afb9876c4e78de96b591e7177649d64

See more details on using hashes here.

Supported by

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