85 lines
3.6 KiB
Python
Executable File
85 lines
3.6 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)
|
|
|
|
# SERVICES TIME PERIODS
|
|
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/analytics/services?startDate=20241008&endDate=20241008&dateKind=0", headers=headers)
|
|
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/analytics/services/cancelled?startDate=20241008&endDate=20241008&dateKind=0", headers=headers)
|
|
|
|
# PAYMENTS TIME PERIOD
|
|
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/analytics/payments?startDateTime=202408010000&endDateTime=202408072359&includeServices=true", headers=headers)
|
|
|
|
# BOOKINGS TIME PERIOD
|
|
# 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-01T00:00&modifiedTo=2024-01-30T23:59&state=Cancelled", headers=headers)
|
|
|
|
# BOOKING
|
|
# 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/bookings/20241106-503875-1217522037", headers=headers) # Cancelled booking
|
|
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings/20240727-503875-1216958604", headers=headers)
|
|
|
|
# INVOICES
|
|
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings/20241009-503875-1220777184/invoices?language=en", headers=headers)
|
|
|
|
# BOOKINGS ROOMS
|
|
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/bookings/20241009-503875-1220777184/rooms", headers=headers)
|
|
|
|
# ALL COMPANIES
|
|
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/companies", headers=headers)
|
|
|
|
# GUESTS needs guest id
|
|
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/guests/9007199255607320", headers=headers)
|
|
|
|
# ROOM STAYS needs guest id
|
|
# response = requests.get("https://connect.hopenapi.com/api/exelypms/v1/guests/9007199255607320/room-stays", headers=headers)
|
|
|
|
# ALL ROOMS
|
|
# 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}")
|