room.py 904 B

12345678910111213141516171819202122232425262728293031
  1. from common.setting import Config
  2. import requests
  3. from common.utils import call_api
  4. class RoomApi:
  5. def get_element_by_room_id(self, room_id, open_client="RIIL"):
  6. """
  7. 获取机房下的元素。
  8. :param room_id: 机房ID
  9. :param open_client: 客户端标识,默认为"RIIL"
  10. :return: 机房元素数据的JSON响应
  11. """
  12. endpoint = f"/room/getElement/{room_id}"
  13. params = {"_openCLIENT": open_client}
  14. return call_api(endpoint, method="POST", params=params)
  15. def get_all_room(self, open_client="RIIL"):
  16. """
  17. 获取所有机房的列表。
  18. :param open_client: 客户端标识,默认为"RIIL"
  19. :return: 机房列表数据的JSON响应
  20. """
  21. endpoint = "/room/getRoom"
  22. params = {"_openCLIENT": open_client}
  23. return call_api(endpoint, method="POST", params=params)