test-3000.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import requests
  2. # --- test 获取token ---
  3. # url = 'http://58.34.94.177:29101/v1/token'
  4. # url = 'http://127.0.0.1:9000/v1/token'
  5. url = 'http://10.10.60.237:9000/v1/token'
  6. data = {
  7. 'username': 'admin', # 用户名
  8. 'password': '123456', # 密码
  9. }
  10. response = requests.post(url=url, json=data)
  11. code = response.json().get('code')
  12. token = response.headers.get('authorization')
  13. # print(code, token)
  14. # --- test 3001 查询驾驶人员操作记录列表 ---
  15. # url = 'http://58.34.94.177:29101/v6/api'
  16. url = 'http://10.10.60.237:9000/v6/api'
  17. data = {
  18. 'code': 3001, # 接口号
  19. 'page': 1, # 页码
  20. 'size': 3, # 每页条数
  21. 'pid': '', # 模糊查询,车牌号(可选项)
  22. 'driver_name': '', # 模糊查询,驾驶员(可选项)
  23. }
  24. response = requests.post(url=url, json=data, headers={'authorization': token})
  25. print(response.json())
  26. """
  27. {
  28. 'code': 0,
  29. 'data': [
  30. {
  31. 'uuid': '65dbe96949fbe311a3a01d30',
  32. 'pid': 'AA112233',
  33. 'start_time_at': 1708917227,
  34. 'end_time_at': 1708946027,
  35. 'driver_name': '张三',
  36. 'cockpit_name': '1号舱'
  37. }
  38. ],
  39. 'total': 1,
  40. 'page': 1,
  41. 'size': 3
  42. }
  43. """
  44. # --- test 3002 下载指定驾驶人员操作日志 ---
  45. url = 'http://58.34.94.177:29101/v6/api'
  46. params = {
  47. 'code': 3002, # 接口号
  48. 'uuid': '65dbe96949fbe311a3a01d30', # 日志id
  49. }
  50. response = requests.get(url=url, params=params, headers={'authorization': token})
  51. print(response.text)