How to use the ipinfo.getHandler function in ipinfo

To help you get started, we’ve selected a few ipinfo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ipinfo / django / ipinfo_django / middleware.py View on Github external
def __init__(self, get_response=None):
        """Initializes class while gettings user settings and creating the cache."""
        self.get_response = get_response
        self.filter = getattr(settings, "IPINFO_FILTER", self.is_bot)

        ipinfo_token = getattr(settings, "IPINFO_TOKEN", None)
        ipinfo_settings = getattr(settings, "IPINFO_SETTINGS", {})
        self.ipinfo = ipinfo.getHandler(ipinfo_token, **ipinfo_settings)