import requests # 设定接口 URL leaderboard_url = 'http://127.0.0.1:8000/polls/leaderboard/' # 发送 GET 请求 response = requests.get(leaderboard_url) # 检查请求是否成功 if response.status_code == 200: print("排行榜数据:", response.json()) else: print("请求失败:", response.status_code, response.text)