Обновление API Utils для работы с медиа
This commit is contained in:
14
api/views.py
14
api/views.py
@@ -1,6 +1,4 @@
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse, HttpResponseBadRequest
|
||||
from .api_methods import api_call_method, api_get_documentation
|
||||
@@ -30,8 +28,12 @@ async def call_method(request, method_name):
|
||||
# защита от нескольких параметров с одним именем
|
||||
api_params[p] = params[p]
|
||||
|
||||
out = await api_call_method(method_name, api_params)
|
||||
out = await api_call_method(request, method_name, api_params)
|
||||
|
||||
if isinstance(out, dict):
|
||||
response = HttpResponse(json.dumps(out, default=_default_serializer, ensure_ascii=False, indent=4))
|
||||
response.headers["Content-type"] = "application/json; charset=utf-8"
|
||||
return response
|
||||
else:
|
||||
return out
|
||||
|
||||
response = HttpResponse(json.dumps(out, default=_default_serializer, ensure_ascii=False, indent=4))
|
||||
response.headers["Content-type"] = "application/json; charset=utf-8"
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user