import requests # --- test 获取token --- url = 'http://10.10.61.229:9000/token/api' data = { 'username': 'admin', # 用户名 'password': 'admin', # 密码 } response = requests.post(url=url, json=data) code = response.json().get('code') token = response.headers.get('authorization') # print(code, token) # --- test 5001 获取告警数据列表接口 --- # --- test 5001 获取告警数据列表接口 --- url = 'http://10.10.61.229:9000/v5/api' data = { 'code': 5001, # 接口号 } response = requests.post(url=url, json=data, headers={'authorization': token}) print(response.json()) """ { 'code': 0, 'data': [ { 'message': '1号车油量低,请及时加油!', # 警告内容 'create_at': 1704435199 # 警告时间(时间戳) } ] } """