You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
398 B

  1. import json
  2. from django.http import JsonResponse
  3. def api_home(request,*args,**kwargs):
  4. body = request.body # byte string of Json data
  5. data = {}
  6. try:
  7. data = json.loads(body) #string of json data ---> python dict
  8. except:
  9. pass
  10. data['headers'] = dict(request.headers)
  11. data['content_type'] = request.content_type
  12. print(data)
  13. return JsonResponse(data)