Reformatting & cleanup

This commit is contained in:
R. Miles McCain
2020-04-24 16:29:23 -04:00
parent 3a63f6f850
commit 62844db6bf
10 changed files with 55 additions and 45 deletions

View File

@@ -42,7 +42,15 @@ def _geoip2_lookup(ip):
@shared_task
def ingress_request(
service_uuid, tracker, time, payload, ip, location, user_agent, dnt=False, identifier=""
service_uuid,
tracker,
time,
payload,
ip,
location,
user_agent,
dnt=False,
identifier="",
):
try:
service = Service.objects.get(pk=service_uuid, status=Service.ACTIVE)
@@ -78,7 +86,8 @@ def ingress_request(
if (
ua.is_bot
or (ua.browser.family or "").strip().lower() == "googlebot"
or (ua.device.family or ua.device.model or "").strip().lower() == "spider"
or (ua.device.family or ua.device.model or "").strip().lower()
== "spider"
):
device_type = "ROBOT"
elif ua.is_mobile:

View File

@@ -2,14 +2,15 @@ import base64
import json
from django.conf import settings
from django.core.cache import cache
from django.http import HttpResponse
from django.shortcuts import render, reverse
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import TemplateView, View
from django.core.cache import cache
from ipware import get_client_ip
from core.models import Service
from ..tasks import ingress_request