diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 7faa83b..abfd1d4 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -20,3 +20,4 @@ reportlab==2.7 requests==2.8.1 six==1.10.0 djangorestframework==2.4.8 +django-ipware==1.1.6 diff --git a/sigi/apps/whois/views.py b/sigi/apps/whois/views.py index 4115b1e..aad3675 100644 --- a/sigi/apps/whois/views.py +++ b/sigi/apps/whois/views.py @@ -6,6 +6,7 @@ from django.views.decorators.csrf import csrf_exempt from rest_framework import status, permissions from rest_framework.response import Response from rest_framework.decorators import api_view, permission_classes +from ipware.ip import get_ip import re from urlparse import urlparse @@ -20,7 +21,7 @@ class WhitelistPermission(permissions.BasePermission): """ def has_permission(self, request, view): - ip_addr = request.META['REMOTE_ADDR'] + ip_addr = get_ip(request) if ip_addr in WHOIS_WHITELIST: return True else: