摘要:
点击查看代码 import re import requests from lxml import etree import asyncio import aiohttp import aiofiles import os from Crypto.Cipher import AES # 获取第一层m 阅读全文
摘要:
点击查看代码 class NBCharField(serializers.IntegerField): def __init__(self, method_name=None, **kwargs): self.method_name = method_name super().__init__(** 阅读全文
摘要:
点击查看代码 class Field: _creation_counter = 0 def __init__(self): self._creation_counter = Field._creation_counter Field._creation_counter += 1 class Inte 阅读全文
摘要:
点击查看代码 class HomeView(APIView): # 规定传入的数据可以用JSON格式和Form格式 parser_classes = [JSONParser, FormParser] # 根据请求头选择解析器,寻找渲染器 content_negotiation_class = Def 阅读全文
摘要:
点击查看代码 class APIView(View): def dispatch(self, request, *args, **kwargs): self.args = args self.kwargs = kwargs request = self.initialize_request(requ 阅读全文
摘要:
点击查看代码 urlpatterns = [ # 1. 访问视图函数中的LoginView()类中的as_view()方法 path('login/', views.LoginView.as_view()), ] 点击查看代码 # 可自定义detail code class Throttled(AP 阅读全文
摘要:
点击查看代码 class APIView(View): permission_classes = api_settings.DEFAULT_PERMISSION_CLASSES def permission_denied(self, request, message=None, code=None) 阅读全文
摘要:
点击查看代码 class Request: def __init__(self, request, authenticators=None): self._request = request self.authenticators = authenticators or () @property d 阅读全文
摘要:
点击查看代码 源码解析: class APIView(View): # 请求函数内的request,*args, **kwargs传给父类APIView内的dispatch()函数 def dispatch(self, request, *args, **kwargs): self.args = a 阅读全文
摘要:
点击查看代码 path('example/', views.ExampleView.as_view()) # as_view()作为入口函数,先去类ExampleView()中找as_view()函数 点击查看代码 # 类ExampleView()中没有找到,去父类APIView()中找as_vie 阅读全文