leduong django api

Solutions on MaxInterview for leduong django api by the best coders in the world

showing results for - "leduong django api"
Struan
18 Apr 2018
1from time import time
2
3from django.http import JsonResponse
4
5
6def api_params(request):
7    ts = time()
8    if request.method == "GET":
9        try:
10            params = request.GET.dict()
11            results = JsonResponse({"params": list(params)})
12
13        except Exception as e:
14            results = JsonResponse({"errors": list(e)})
15    print('Took: ', time() - ts, 's')
16    return results
17
queries leading to this page
leduong django apileduong django api