Files
Touchh/pms_integration/plugins/bnovo_pms.py

32 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# pms_integration/plugins/example_pms.py
import requests
from .base_plugin import BasePMSPlugin
class ExamplePMSPlugin(BasePMSPlugin):
"""Плагин для интеграции с Example PMS."""
def fetch_data(self):
"""Получение данных от Example PMS."""
url = self.api_config.url
headers = {"Authorization": f"Bearer {self.api_config.token}"}
response = requests.get(url, headers=headers, timeout=10)
response.raise_for_status()
return response.json()
def parse_data(self, raw_data):
"""Обработка данных от Example PMS."""
reservations = raw_data.get("reservations", [])
return [
{
"id": res["id"],
"room_number": res["room_number"],
"room_type": res["room_type"],
"check_in": res["check_in"],
"check_out": res["check_out"],
"status": res["status"],
"price": res.get("price"),
}
for res in reservations
]