Handshake looks servicable

This commit is contained in:
Jonas Linter
2025-09-25 13:38:53 +02:00
parent 03556df10e
commit 89cbb3301b
3 changed files with 171 additions and 13 deletions

View File

@@ -299,16 +299,24 @@ class PingAction(AlpineBitsAction):
# Create successful ping response with matched capabilities
capabilities_json = json.dumps(matching_capabilities, indent=2)
response_xml = f'''<?xml version="1.0" encoding="UTF-8"?>
<OTA_PingRS xmlns="http://www.opentravel.org/OTA/2003/05" Version="8.000">
<Success/>
<Warnings>
<Warning Type="11" Status="AlpineBitsHandshake">{capabilities_json}</Warning>
</Warnings>
<EchoData>{capabilities_json}</EchoData>
</OTA_PingRS>'''
warning = OtaPingRs.Warnings.Warning(type_value=WarningStatus.ALPINEBITS_HANDSHAKE.value, code="11", content=[capabilities_json])
warning_response = OtaPingRs.Warnings(warning=[warning])
response_ota_ping = OtaPingRs(version= "7.000", warnings=warning_response, echo_data=capabilities_json)
config = SerializerConfig(
pretty_print=True, xml_declaration=True, encoding="UTF-8"
)
serializer = XmlSerializer(config=config)
response_xml = serializer.render(response_ota_ping, ns_map={None: "http://www.opentravel.org/OTA/2003/05"})
@@ -338,7 +346,7 @@ class HotelAvailNotifAction(AlpineBitsAction):
def __init__(self):
self.name = AlpineBitsActionName.OTA_HOTEL_AVAIL_NOTIF
self.version = Version.V2024_10
self.version = Version.V2022_10
self.supports = [
"OTA_HotelAvailNotif_accept_rooms",
"OTA_HotelAvailNotif_accept_categories",
@@ -450,6 +458,10 @@ class AlpineBitsServer:
else:
return await action_instance.handle(request_action_name, request_xml, version_enum)
except Exception as e:
print(f"Error handling request {request_action_name}: {str(e)}")
# print stack trace for debugging
import traceback
traceback.print_exc()
return AlpineBitsResponse(
f"Error: Internal server error while processing {request_action_name}: {str(e)}",
HttpStatusCode.INTERNAL_SERVER_ERROR