123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import requests
- # --- test 获取token ---
- # url = 'http://58.34.94.177:29101/v1/token'
- # url = 'http://127.0.0.1:9000/v1/token'
- url = 'http://10.10.60.237:9000/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'
- url = 'http://10.10.60.237:9000/v6/api'
- data = {
- 'code': 3001, # 接口号
- 'page': 1, # 页码
- 'size': 3, # 每页条数
- 'pid': '', # 模糊查询,车牌号(可选项)
- 'driver_name': '', # 模糊查询,驾驶员(可选项)
- }
- 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,
- 'uuid': '65dbe96949fbe311a3a01d30',
- }
- response = requests.get(url=url, params=params, headers={'authorization': token})
- print(response.text)
|