Reading handshake into python works
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OTA_ResRetrieveRS xmlns="http://www.opentravel.org/OTA/2003/05" Version="7.000">
|
||||
<ReservationsList>
|
||||
<HotelReservation CreateDateTime="2025-09-25T07:09:25.703515+00:00" ResStatus="Requested" RoomStayReservation="true">
|
||||
<HotelReservation CreateDateTime="2025-09-25T07:41:25.075608+00:00" ResStatus="Requested" RoomStayReservation="true">
|
||||
<UniqueID Type="14" ID="6b34fe24ac2ff811"/>
|
||||
<RoomStays>
|
||||
<RoomStay>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "alpine-bits-python-server"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
description = "Alpine Bits Python Server implementation"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
@@ -13,13 +17,15 @@ dependencies = [
|
||||
"xsdata[cli,lxml,soap]>=25.7",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
alpine-bits-server = "alpine_bits_python.main:main"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/alpine_bits_python_server"]
|
||||
packages = ["src/alpine_bits_python"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
testpaths = ["test"]
|
||||
pythonpath = ["src"]
|
||||
|
||||
[tool.ruff]
|
||||
src = ["src", "tests"]
|
||||
src = ["src", "test"]
|
||||
5
src/alpine_bits_python/__main__.py
Normal file
5
src/alpine_bits_python/__main__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
"""Entry point for alpine_bits_python package."""
|
||||
from .main import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -11,7 +11,7 @@ import json
|
||||
from typing import Dict, List, Optional, Any
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
from generated.alpinebits import OtaPingRq, OtaPingRs, WarningStatus
|
||||
from .generated.alpinebits import OtaPingRq, OtaPingRs, WarningStatus
|
||||
from xsdata_pydantic.bindings import XmlSerializer
|
||||
from xsdata.formats.dataclass.serializers.config import SerializerConfig
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from generated.alpinebits import (
|
||||
from .alpinebits import (
|
||||
BaseByGuestAmtType,
|
||||
BookingRuleCodeContext,
|
||||
CommentName1,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from .alpinebits_guestrequests import ResGuest, RoomStay
|
||||
import generated.alpinebits as ab
|
||||
from .generated import alpinebits as ab
|
||||
from io import BytesIO
|
||||
import sys
|
||||
from datetime import datetime, timezone
|
||||
import re
|
||||
from xsdata_pydantic.bindings import XmlSerializer
|
||||
|
||||
from simplified_access import (
|
||||
from .simplified_access import (
|
||||
CommentData,
|
||||
CommentsData,
|
||||
CommentListItemData,
|
||||
|
||||
@@ -4,7 +4,7 @@ from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
||||
# Import the generated classes
|
||||
from generated.alpinebits import OtaHotelResNotifRq, OtaResRetrieveRs, CommentName2
|
||||
from .generated.alpinebits import OtaHotelResNotifRq, OtaResRetrieveRs, CommentName2
|
||||
|
||||
# Define type aliases for the two Customer types
|
||||
NotifCustomer = OtaHotelResNotifRq.HotelReservations.HotelReservation.ResGuests.ResGuest.Profiles.ProfileInfo.Profile.Customer
|
||||
|
||||
1
src/alpine_bits_python/util/__init__.py
Normal file
1
src/alpine_bits_python/util/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Utility functions for alpine_bits_python."""
|
||||
5
src/alpine_bits_python/util/__main__.py
Normal file
5
src/alpine_bits_python/util/__main__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
"""Entry point for util package."""
|
||||
from .handshake_util import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,4 +1,5 @@
|
||||
from generated.alpinebits import OtaPingRq, OtaPingRs
|
||||
from ..generated.alpinebits import OtaPingRq, OtaPingRs
|
||||
from xsdata_pydantic.bindings import XmlParser
|
||||
|
||||
|
||||
|
||||
@@ -6,15 +7,26 @@ from generated.alpinebits import OtaPingRq, OtaPingRs
|
||||
def main():
|
||||
# test parsing a ping request sample
|
||||
|
||||
path = "../../AlpineBits-HotelData-2024-10/files/samples/Handshake/Handshake-OTA_PingRQ.xml"
|
||||
path = "AlpineBits-HotelData-2024-10/files/samples/Handshake/Handshake-OTA_PingRQ.xml"
|
||||
|
||||
with open(
|
||||
path, "r", encoding="utf-8") as f:
|
||||
xml = f.read()
|
||||
|
||||
# Parse the XML into the request object
|
||||
request = OtaPingRq.from_xml(xml)
|
||||
print("Parsed OTA_PingRQ:", request)
|
||||
|
||||
# Test parsing back
|
||||
|
||||
|
||||
parser = XmlParser()
|
||||
|
||||
|
||||
|
||||
parsed_result = parser.from_string(xml, OtaPingRq)
|
||||
|
||||
print(parsed_result.echo_data)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
Reference in New Issue
Block a user