debug in proof call

This commit is contained in:
Cayo Puigdefabregas 2024-11-28 16:54:31 +01:00
parent 53524643c8
commit 1910609f68

View file

@ -1,3 +1,4 @@
import logging
from django.views.generic.edit import View
from django.http import JsonResponse
@ -6,10 +7,16 @@ from dpp.models import Proof
from dpp.api_dlt import ALGORITHM
logger = logging.getLogger('django')
class ProofView(View):
def get(self, request, *args, **kwargs):
timestamp = kwargs.get("proof_id")
for p in Proof.objects.filter():
logger.error(p.timestamp)
proof = Proof.objects.filter(timestamp=timestamp).first()
if not proof:
return JsonResponse({}, status=404)
@ -31,6 +38,9 @@ class ProofView(View):
'@context': ['https://ereuse.org/proof0.json'],
'data': data,
}
return JsonResponse(d, status=200)
response = JsonResponse(d, status=200)
response["Access-Control-Allow-Origin"] = "*"
return response
return JsonResponse({}, status=404)