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 2001 新增车辆 --- # url = 'http://58.34.94.177:29101/v6/api' # data = { # 'code': 2001, # 接口号 # 'pid': 'AA998877', # 车牌号(必须项) # 'type': '112233', # 车型号(可选项) # 'host_address': 'xxx.xxx.xxx.xxx', # 工控机地址(可选项) # 'rtk_address': 'xxx.xxx.xxx.xxx', # rtk地址(可选项) # 'cpe_address': 'xxx.xxx.xxx.xxx', # cpe地址(可选项) # 'release_at': '2022-12-12', # 出厂日期(可选项) # } # response = requests.post(url=url, json=data, headers={'authorization': token}) # print(response.json()) # --- test 2002 查询车辆列表 --- # url = 'http://58.34.94.177:29101/v6/api' # data = { # 'code': 2002, # 接口号 # 'page': 1, # 页码 # 'size': 3, # 每页条数 # 'pid': 'AA', # 模糊查询,车牌号(可选项) # } # response = requests.post(url=url, json=data, headers={'authorization': token}) # print(response.json()) # """ # { # 'code': 0, # 'data': [ # { # 'uuid': '65dbe96949fbe311a3a01d30', # 'pid': 'AA112233', # 'type': '112233', # 'host_address': 'xxx.xxx.xxx.xxx', # 'rtk_address': 'xxx.xxx.xxx.xxx', # 'cpe_address': 'xxx.xxx.xxx.xxx', # 'release_at': '2022-12-12', # 'state': 1, # 当前状态 (1:离线 2:在线空闲 3: 现场驾驶中 4: 远程驾驶中) # 'permit_state': 0 # 遥操状态 (0:允许 1:禁用) # } # ] # } # """ # --- test 2003 修改指定车辆信息 --- # url = 'http://58.34.94.177:29101/v6/api' # data = { # 'code': 2003, # 接口号 # 'uuid': '65dbe96949fbe311a3a01d30', # 车辆id(必须项) # 'pid': 'AA112233', # 车牌号(可选项) # 'type': '三一/SMHW48', # 车型号(可选项) # 'host_address': 'xxx.xxx.xxx.xxx', # 工控机地址(可选项) # 'rtk_address': 'xxx.xxx.xxx.xxx', # rtk地址(可选项) # 'cpe_address': 'xxx.xxx.xxx.xxx', # cpe地址(可选项) # 'release_at': '2022-12-12', # 出厂日期(可选项) # } # response = requests.post(url=url, json=data, headers={'authorization': token}) # print(response.json()) # --- test 2004 禁止指定车辆远程操作 --- # url = 'http://58.34.94.177:29101/v6/api' # data = { # 'code': 2004, # 接口号 # 'uuid': '65dbe96949fbe311a3a01d30', # 车辆id(必须项) # } # response = requests.post(url=url, json=data, headers={'authorization': token}) # print(response.json()) # --- test 2005 允许指定车辆远程操作 --- # url = 'http://58.34.94.177:29101/v6/api' # data = { # 'code': 2005, # 接口号 # 'uuid': '65dbe96949fbe311a3a01d30', # 车辆id(必须项) # } # response = requests.post(url=url, json=data, headers={'authorization': token}) # print(response.json()) # --- test 2006 删除指定作业车辆 --- # url = 'http://58.34.94.177:29101/v6/api' # data = { # 'code': 2006, # 接口号 # 'uuid': '65dd95e244b74ae33732d810', # 车辆id(必须项) # } # response = requests.post(url=url, json=data, headers={'authorization': token}) # print(response.json()) # --- test 2007 获取指定作业车辆详情 --- url = 'http://58.34.94.177:29101/v6/api' data = { 'code': 2007, # 接口号 'uuid': '65de9fa044b74ae33732d811', # 车辆id(必须项) } response = requests.post(url=url, json=data, headers={'authorization': token}) print(response.json())