import requests # --- test 获取token --- url = 'http://58.34.94.177:29101/v1/token' data = { 'username': 'admin', # 用户名 'password': '123456', # 密码 } response = requests.post(url=url, json=data) code = response.json().get('code') token = response.headers.get('authorization') # print(code, token) # --- test 3001 查询驾驶人员操作记录列表 --- # url = 'http://58.34.94.177:29101/v6/api' # data = { # 'code': 3001, # 接口号 # 'page': 1, # 页码 # 'size': 3, # 每页条数 # 'pid': 'AA', # 模糊查询,车牌号(可选项) # 'driver_name': 'AABBXX', # 模糊查询,驾驶员(可选项) # } # response = requests.post(url=url, json=data, headers={'authorization': token}) # print(response.json()) # """ # { # 'code': 0, # 'data': [ # { # 'uuid': '65dbe96949fbe311a3a01d30', # 'pid': 'AA112233', # 'start_time_at': 1708917227, # 'end_time_at': 1708946027, # 'driver_name': '张三', # 'cockpit_name': '1号舱' # } # ], # 'total': 1, # 'page': 1, # 'size': 3 # } # """ # --- test 3002 下载指定驾驶人员操作日志 --- # url = 'http://58.34.94.177:29101/v6/api' # params = {'code': 3002} # response = requests.get(url=url, params=params, headers={'authorization': token}) # print(response.text) # requests.get(url='http://58.34.94.177:29101/v6/api?code=3002').text