import requests # --- test 获取token --- # url = 'http://10.10.61.229:9000/token/api' url = 'http://192.168.131.23: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') # --- test 4001 获取全部渣包状态数据接口 --- # url = 'http://10.10.61.229:9000/v5/api' url = 'http://192.168.131.23:9000/v5/api' data = { 'code': 4001, # 接口号 } response = requests.post(url=url, json=data, headers={'authorization': token}) print(response.json()) """ { 'code': 0, 'data': [ { 'pot_name': 'A.1', # 渣罐别称 'pot_status': 4, # 渣罐状态 1 空位 2 就绪 3 缓冷(空冷) 4 水冷 5 自冷(水冷) 6 待倒 7 故障 'pot_number': '1' # 渣罐编号 } ] } """