hms_bak/bross.py
2024-10-29 14:44:52 +04:00

75 lines
3.7 KiB
Python
Executable File

#!/usr/bin/env python3
import requests
import hashlib
import json
import sys
headers = {
'X-API-KEY': 'b84f2c33-d9dc-439a-84ff-3deed4b18e10',
'Content-Type': 'application/json',
}
#url = "https://connect.hopenapi.com/api/exelypms/v1/analytics/services"
#payload = {'startDate': '20240909', 'endDate': '20240910', 'dateKind': 0, 'language': 'en'}
#response = requests.get(url, data=payload, headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/analytics/services?startDate=20241008&endDate=20241008&dateKind=4", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings/20240301-503875-1211582391", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings/20241217-503875-1220773707", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings/20240122-503875-1210423183", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings/20240909-503875-1219004943", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings/20241009-503875-1220777184", headers=headers) # Room move
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/guests/9007199255607320", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/rooms", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/companies", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings/20241009-503875-1220777184/rooms", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/analytics/services", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/analytics/payments", headers=headers)
response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/analytics/payments?startDateTime=202408010000&endDateTime=202408012359&includeServices=true", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings?modifiedFrom=2024-01-01T00:00&modifiedTo=2024-01-30T23:59&state=Active", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings?modifiedFrom=2024-01-31T23:59&modifiedTo=2024-02-290T23:59&state=Active", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings?modifiedFrom=2024-10-08T20:00&modifiedTo=2024-10-08T22:00&state=Cancelled", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/rooms", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/rooms?roomTypeId=5020078", headers=headers)
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/rooms?roomTypeId=5019645", headers=headers)
if response.status_code == 200:
data = response.json()
print(data)
json_data = json.dumps(data, sort_keys=True)
hash_object = hashlib.sha256(json_data.encode())
hash_hex = hash_object.hexdigest()
print(f"SHA-256 Hash: {hash_hex}")
sys.exit()
for i in data['data']['services']:
pass
#print(i)
for i in data['data']['customers']:
pass
#print(i)
for i in data['data']['agents']:
pass
#print(i)
for i in data['data']['reservations']:
#pass
print(i)
#if i['guestId'] == '9007199257013459_9007199256429978':
# print(i)
for i in data['data']['roomTypes']:
pass
#print(i)
else:
print(response.json())
print(f"Failed to retrieve data. Status code: {response.status_code}")