This commit is contained in:
Fyodor Alyokhin 2026-02-02 13:21:04 +01:00
parent 22e996640d
commit 75c374dedf
6 changed files with 280 additions and 17 deletions

View file

@ -36,7 +36,8 @@ class BookingClient:
try:
resources = response.json().get('data', [])
except (ValueError, JSONDecodeError):
print(f"❌ Invalid JSON response when fetching resources: {response.text[:200]}")
print(f"❌ Invalid JSON response when fetching resources: {response.text}")
# print(f"❌ Invalid JSON response when fetching resources: {response.text[:200]}")
return None
return resources[-1]['id'] if resources else None
@ -56,10 +57,13 @@ class BookingClient:
"customer_note": "",
"add_ons_by_service": {SERVICE_ID: [[]]},
"sub_bookings_by_service": {},
"booking_quota_grant_id":"24735199",
"strategy": "multi-resource"
}
# data = '{"resource_id":["15994"],"service_id":{"601":1},"start_date":"2026-02-03T22:30:00+01:00","end_date":"2026-02-03T23:30:00+01:00","description":"","customer_note":"","add_ons_by_service":{"601":[[]]},"sub_bookings_by_service":{},"booking_quota_grant_id":"24735199","strategy":"multi-resource"}'
)
print("resource id: %s" % resource_id)
if not booking.ok:
print(f"❌ Booking failed: HTTP {booking.status_code}")
return False
@ -67,7 +71,8 @@ class BookingClient:
try:
data = booking.json().get("data", {})
except (ValueError, JSONDecodeError):
print(f"❌ Invalid JSON response from booking request: {booking.text[:200]}")
# print(f"❌ Invalid JSON response from booking request: {booking.text[:200]}")
print(f"❌ Invalid JSON response from booking request: {booking.text}")
return False
oid = data.get("id")
@ -85,7 +90,8 @@ class BookingClient:
try:
customer = checkout.json().get("default", {}).get("customer", {})
except (ValueError, JSONDecodeError):
print(f"❌ Invalid JSON response from checkout form: {checkout.text[:200]}")
print(f"❌ Invalid JSON response from checkout form: {checkout.text}")
# print(f"❌ Invalid JSON response from checkout form: {checkout.text[:200]}")
return False
final = self.session.post(