删除 test_api.py

This commit is contained in:
蔡朗 2026-01-07 14:48:35 +08:00
parent 8e52b36777
commit c1cb220192

View File

@ -1,32 +0,0 @@
import requests
import json
# API测试脚本
BASE_URL = 'http://127.0.0.1:5000'
TEST_HEADER_URL = 'http://127.0.0.1:5001'
API_KEY = 'sk-0944c102849e45d9ab3f24d5169de289'
# 设置请求头
headers = {
'Content-Type': 'application/json',
'X-API-Key': API_KEY
}
try:
print("=== 测试Header调试端点 ===")
response = requests.get(f'{TEST_HEADER_URL}/test_headers', headers=headers)
print(f"状态码: {response.status_code}")
print(f"响应内容: {json.dumps(response.json(), ensure_ascii=False, indent=2)}")
# 测试分析回答API
print("\n=== 测试分析回答API ===")
analyze_data = {
'question_id': 1,
'answer': '我是一名有5年经验的软件工程师主要从事Python开发工作。'
}
response = requests.post(f'{BASE_URL}/analyze_answer', headers=headers, json=analyze_data)
print(f"状态码: {response.status_code}")
print(f"响应内容: {json.dumps(response.json(), ensure_ascii=False, indent=2)}")
except Exception as e:
print(f"测试失败: {str(e)}")