event_client.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from common.utils import call_api, save_json
  2. class EventClientApi:
  3. def accept_event(self, event_id):
  4. """
  5. 受理事件。
  6. """
  7. endpoint = f"/event/client/accept/{event_id}"
  8. params = {"_openCLIENT": "RIIL"}
  9. return call_api(endpoint, method="GET", params=params)
  10. def query_event_list(self, view_type, isPageing=0, pageIndex=1, pageSize=20):
  11. """
  12. 查询事件列表。
  13. """
  14. params = {
  15. "viewType": view_type,
  16. "_openCLIENT": "RIIL",
  17. "isPageing": isPageing,
  18. "pageSize": pageSize,
  19. "pageIndex": pageIndex
  20. }
  21. return call_api("/event/client/getEventList", method="POST", params=params)
  22. def get_log_alarm_list(self):
  23. """
  24. 获取日志事件列表。
  25. """
  26. params = {
  27. # "isPageing": "1",
  28. # "pageSize": "20",
  29. # "pageIndex": "1",
  30. "_openCLIENT": "RIIL"
  31. }
  32. return call_api("/event/client/getLogAlarmList", method="POST", params=params)
  33. # if __name__ == '__main__':
  34. # api = EventClientApi()
  35. # unaccepted_event_list = api.query_event_list("unaccepted_event_view")
  36. # accepted_event_list = api.query_event_list("accepted_event_view")
  37. # event_list = api.get_log_alarm_list()
  38. #
  39. # save_json(unaccepted_event_list, "result/event/unaccepted_event_list.json")
  40. # save_json(accepted_event_list, "result/event/accepted_event_list.json")
  41. # save_json(event_list, "result/event/event_list.json")
  42. #