test-3000.py 1.4 KB

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