haha
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import uuid
|
||||
|
||||
from rest_framework import status
|
||||
from rest_framework.decorators import api_view, permission_classes
|
||||
from rest_framework.decorators import api_view, authentication_classes, permission_classes
|
||||
from rest_framework.permissions import AllowAny
|
||||
from rest_framework.response import Response
|
||||
|
||||
@@ -15,6 +15,7 @@ from server.serializers import LoginSerializer
|
||||
|
||||
|
||||
@api_view(["POST"])
|
||||
@authentication_classes([]) # 登录接口不校验 Cookie token,避免未带 Cookie 时被默认权限判为 403
|
||||
@permission_classes([AllowAny])
|
||||
def login(request):
|
||||
"""
|
||||
|
||||
22
测试/test.py
22
测试/test.py
@@ -1,4 +1,20 @@
|
||||
import random
|
||||
import requests
|
||||
|
||||
print(random.randint(1,100))
|
||||
print(random.random())
|
||||
url = "http://8.137.99.82:9000/api/auth/login"
|
||||
|
||||
payload={}
|
||||
files=[
|
||||
|
||||
]
|
||||
headers = {
|
||||
'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
|
||||
'Accept': '*/*',
|
||||
'Host': '8.137.99.82:9000',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'multipart/form-data; boundary=--------------------------967987379917827495982839',
|
||||
'Cookie': 'auth_token=c0ceff1a701e49538965813027f80edb'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, data=payload, files=files)
|
||||
|
||||
print(response.text)
|
||||
|
||||
Reference in New Issue
Block a user