From a315e5f2e13cb2a89d17b5f8ebff1f08c40f3b13 Mon Sep 17 00:00:00 2001 From: 27942 Date: Wed, 25 Feb 2026 00:20:16 +0800 Subject: [PATCH] haha --- server/api/auth.py | 3 ++- 测试/test.py | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/server/api/auth.py b/server/api/auth.py index 27acd5d..421eafa 100644 --- a/server/api/auth.py +++ b/server/api/auth.py @@ -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): """ diff --git a/测试/test.py b/测试/test.py index fc8f5e3..a9b7a20 100644 --- a/测试/test.py +++ b/测试/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)