test-2000.py 3.7 KB

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