9
9
10
10
import json
11
11
12
- from django import http
13
12
from django .contrib .auth import get_user_model
14
13
from django .core import signing
15
14
from django .db import transaction
15
+ from django .http import Http404
16
+ from django .shortcuts import get_object_or_404
16
17
from django .utils import timezone
17
18
from django .views .decorators .csrf import csrf_exempt
18
19
from django .views .decorators .http import require_POST
20
+
19
21
from packageurl import PackageURL
20
22
from rest_framework import serializers , status , viewsets
21
23
from rest_framework .decorators import action
@@ -355,11 +357,11 @@ def send_scan_notification(request, key):
355
357
try :
356
358
json_data = json .loads (request .body .decode ("utf-8" ))
357
359
except json .JSONDecodeError :
358
- raise http . Http404
360
+ raise Http404
359
361
360
362
user_id = signing .loads (key )
361
363
User = get_user_model ()
362
- user = http . get_object_or_404 (User , id = user_id )
364
+ user = get_object_or_404 (User , id = user_id )
363
365
364
366
results = json_data .get ('results' )
365
367
summary = json_data .get ('summary' )
@@ -383,7 +385,7 @@ def send_scan_notification(request, key):
383
385
with open (scan_summary_location , 'wb' ) as f :
384
386
json .dump (summary , f )
385
387
386
- scannable_uri = http . get_object_or_404 (ScannableURI , uuid = scannable_uri_uuid )
388
+ scannable_uri = get_object_or_404 (ScannableURI , uuid = scannable_uri_uuid )
387
389
scannable_uri .process_scan_results (
388
390
scan_results_location = scan_results_location ,
389
391
scan_summary_location = scan_summary_location ,
0 commit comments