1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- 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 3001 任务列表数据获取接口(分页) ---
- # --- test 3001 任务列表数据获取接口(分页) ---
- # url = 'http://192.168.131.23:9000/v5/api'
- # data = {
- # 'code': 3001, # 接口号
- # 'page': 1, # 分页
- # 'size': 10, # 每页条数
- # }
- # response = requests.post(url=url, json=data, headers={'authorization': token})
- # print(response.json())
- # """
- # {
- # 'code': 0,
- # 'data': [
- # {
- # 'vehicle_uuid': '65faa9d5921aec72550fb32d', # 车辆id
- # 'task_type': 101, # 任务类型 101 自动驾驶 102 叉包 103 放包 104 倒渣
- # 'target_point_name': 'F.20', # 目标点名称
- # 'task_state': 1, # 任务状态 1 已经下发 2 已完成 3 中止 4 失败
- # 'create_at': 1711526546, # 创建时间
- # 'uuid': '6603d2922276884b00caa06c' # 任务id
- # }
- # ],
- # 'total': 1,
- # 'page': 1,
- # 'size': 10
- # }
- # """
- # --- test 3003 任务取消接口 ---
- # url = 'http://10.10.61.229:9000/v5/api'
- # url = 'http://192.168.131.23:9000/v5/api'
- # data = {
- # 'code': 3003, # 接口号
- # 'uuid': '659765411dd2f1fe6d346b3b', # 任务id
- # }
- # response = requests.post(url=url, json=data, headers={'authorization': token})
- # print(response.json())
- # """
- # {
- # 'code': 0,
- # 'data': '659765411dd2f1fe6d346b3b'
- # }
- # """
- # --- test 3004 任务创建并执行 ---
- # url = 'http://192.168.131.23:9000/v5/api'
- # data = {
- # 'code': 3004, # 接口号
- # 'uuid': '65faa9d5921aec72550fb32d', # 渣包车唯一标识
- # 'task_type': 101, # 任务类型 101 自动驾驶 102 叉包 103 放包 104 倒渣
- # 'target_point_name': 'F.20', # 目标点名称
- # }
- # response = requests.post(url=url, json=data, headers={'authorization': token})
- # print(response.json())
- # """
- # {
- # 'code': 0,
- # 'data': '659765411dd2f1fe6d346b3b' # 任务id
- # }
- # """
- # --- test 3005 获取指定任务信息 ---
- url = 'http://192.168.131.23:9000/v5/api'
- data = {
- 'code': 3005, # 接口号
- 'uuid': '6603d2922276884b00caa06c', # 任务id
- }
- response = requests.post(url=url, json=data, headers={'authorization': token})
- print(response.json())
- """
- {
- 'code': 0,
- 'data': {
- 'task_type': 101, # 任务类型 101 自动驾驶 102 叉包 103 放包 104 倒渣
- 'target_point_name': 'F.20', # 目标点
- 'task_state': 1, # 任务状态 1 已经下发 2 已完成 3 中止 4 失败
- 'create_at': 1711381601, # 创建时间
- 'uuid': '66019c617b5e102e42bc363a' # 任务id
- }
- }
- """
|