test-2000.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 2001 新增车辆 ---
  13. # url = 'http://58.34.94.177:29101/v6/api'
  14. # data = {
  15. # 'code': 2001, # 接口号
  16. # 'pid': 'AA998877', # 车牌号(必须项)
  17. # 'type': '112233', # 车型号(可选项)
  18. # 'host_address': 'xxx.xxx.xxx.xxx', # 工控机地址(可选项)
  19. # 'rtk_address': 'xxx.xxx.xxx.xxx', # rtk地址(可选项)
  20. # 'cpe_address': 'xxx.xxx.xxx.xxx', # cpe地址(可选项)
  21. # 'release_at': '2022-12-12', # 出厂日期(可选项)
  22. # }
  23. # response = requests.post(url=url, json=data, headers={'authorization': token})
  24. # print(response.json())
  25. # --- test 2002 查询车辆列表 ---
  26. # url = 'http://58.34.94.177:29101/v6/api'
  27. # data = {
  28. # 'code': 2002, # 接口号
  29. # 'page': 1, # 页码
  30. # 'size': 3, # 每页条数
  31. # 'pid': 'AA', # 模糊查询,车牌号(可选项)
  32. # }
  33. # response = requests.post(url=url, json=data, headers={'authorization': token})
  34. # print(response.json())
  35. # """
  36. # {
  37. # 'code': 0,
  38. # 'data': [
  39. # {
  40. # 'uuid': '65dbe96949fbe311a3a01d30',
  41. # 'pid': 'AA112233',
  42. # 'type': '112233',
  43. # 'host_address': 'xxx.xxx.xxx.xxx',
  44. # 'rtk_address': 'xxx.xxx.xxx.xxx',
  45. # 'cpe_address': 'xxx.xxx.xxx.xxx',
  46. # 'release_at': '2022-12-12',
  47. # 'state': 1, # 当前状态 (1:离线 2:在线空闲 3: 现场驾驶中 4: 远程驾驶中)
  48. # 'permit_state': 0 # 遥操状态 (0:允许 1:禁用)
  49. # }
  50. # ]
  51. # }
  52. # """
  53. # --- test 2003 修改指定车辆信息 ---
  54. # url = 'http://58.34.94.177:29101/v6/api'
  55. # data = {
  56. # 'code': 2003, # 接口号
  57. # 'uuid': '65dbe96949fbe311a3a01d30', # 车辆id(必须项)
  58. # 'pid': 'AA112233', # 车牌号(可选项)
  59. # 'type': '三一/SMHW48', # 车型号(可选项)
  60. # 'host_address': 'xxx.xxx.xxx.xxx', # 工控机地址(可选项)
  61. # 'rtk_address': 'xxx.xxx.xxx.xxx', # rtk地址(可选项)
  62. # 'cpe_address': 'xxx.xxx.xxx.xxx', # cpe地址(可选项)
  63. # 'release_at': '2022-12-12', # 出厂日期(可选项)
  64. # }
  65. # response = requests.post(url=url, json=data, headers={'authorization': token})
  66. # print(response.json())
  67. # --- test 2004 禁止指定车辆远程操作 ---
  68. # url = 'http://58.34.94.177:29101/v6/api'
  69. # data = {
  70. # 'code': 2004, # 接口号
  71. # 'uuid': '65dbe96949fbe311a3a01d30', # 车辆id(必须项)
  72. # }
  73. # response = requests.post(url=url, json=data, headers={'authorization': token})
  74. # print(response.json())
  75. # --- test 2005 允许指定车辆远程操作 ---
  76. # url = 'http://58.34.94.177:29101/v6/api'
  77. # data = {
  78. # 'code': 2005, # 接口号
  79. # 'uuid': '65dbe96949fbe311a3a01d30', # 车辆id(必须项)
  80. # }
  81. # response = requests.post(url=url, json=data, headers={'authorization': token})
  82. # print(response.json())
  83. # --- test 2006 删除指定作业车辆 ---
  84. # url = 'http://58.34.94.177:29101/v6/api'
  85. # data = {
  86. # 'code': 2006, # 接口号
  87. # 'uuid': '65dd95e244b74ae33732d810', # 车辆id(必须项)
  88. # }
  89. # response = requests.post(url=url, json=data, headers={'authorization': token})
  90. # print(response.json())
  91. # --- test 2007 获取指定作业车辆详情 ---
  92. url = 'http://58.34.94.177:29101/v6/api'
  93. data = {
  94. 'code': 2007, # 接口号
  95. 'uuid': '65de9fa044b74ae33732d811', # 车辆id(必须项)
  96. }
  97. response = requests.post(url=url, json=data, headers={'authorization': token})
  98. print(response.json())