12345678910111213141516171819202122232425262728293031323334 |
- # -*- coding: utf-8 -*-
- from drf_yasg import openapi
- from drf_yasg.utils import swagger_auto_schema
- from rest_framework.viewsets import ViewSet
- from django.http import HttpResponse
-
-
- tags = ['user']
-
- class User(ViewSet):
- @swagger_auto_schema(
- operation_description="apiview post description override",
- request_body=openapi.Schema(
- type=openapi.TYPE_OBJECT,
- required=['page', 'pageSize'],
- properties={
- 'page': openapi.Schema(type=openapi.TYPE_NUMBER),
- 'pageSize': openapi.Schema(type=openapi.TYPE_NUMBER),
- },
- ),
- security=[], tags=tags, operation_summary='列表')
- def list(self, request):
- print('debug')
- msg=''
- try:
- # print("post_post",request.POST)
- print("post_body",request.body)
- msg='Hello! Users. body : %s' % (request.body)
- except(RuntimeError, TypeError, NameError) as e:
- print(e)
- msg='Hello! Users. exception'
- return HttpResponse(msg)
- # pass
|