leduong django api
from time import time
from django.http import JsonResponse
def api_params(request):
ts = time()
if request.method == "GET":
try:
params = request.GET.dict()
results = JsonResponse({"params": list(params)})
except Exception as e:
results = JsonResponse({"errors": list(e)})
print('Took: ', time() - ts, 's')
return results