You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
997 B

2 months ago
import requests
import json
# 点名请求
roll_call_url = 'http://127.0.0.1:8000/polls/roll_call/'
roll_call_response = requests.post(roll_call_url, json={'start_roll_call': 'true'})
if roll_call_response.status_code == 200:
print("点名成功:", roll_call_response.json())
selected_student_id = roll_call_response.json()['student_id']
# 确认点名请求
confirm_roll_call_url = 'http://127.0.0.1:8000/polls/confirm_roll_call/'
confirm_data = {
'student_id': selected_student_id,
'attended': 'true',
'question_repeat': 'accurate',
'answer_accuracy': 2.0
}
confirm_response = requests.post(confirm_roll_call_url, json=confirm_data)
if confirm_response.status_code == 200:
print("确认点名成功:", confirm_response.json())
else:
print("确认点名失败:", confirm_response.status_code, confirm_response.text)
else:
print("点名失败:", roll_call_response.status_code, roll_call_response.text)