Git Product home page Git Product logo

opentravel-xml-api's Introduction

Open Travel XML API

Python API to easily generate Open Travel XML messages

Basic Usage

>>> from ota_xml_api.ota2011b import hotel_avail
>>> request = hotel_avail.HotelAvailRQ()
>>> str(request)
'<OTA_HotelAvailRQ xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_HotelAvailRQ.xsd"><POS><Source><RequestorID/></Source><Source><RequestorID/></Source></POS><AvailRequestSegments><AvailRequestSegment><HotelSearchCriteria/></AvailRequestSegment></AvailRequestSegments></OTA_HotelAvailRQ>'
>>> request.info_source = 'Distribution'
>>> str(request)
'<OTA_HotelAvailRQ xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_HotelAvailRQ.xsd"><POS><Source><RequestorID/></Source><Source><RequestorID/></Source></POS><AvailRequestSegments><AvailRequestSegment InfoSource="Distribution"><HotelSearchCriteria/></AvailRequestSegment></AvailRequestSegments></OTA_HotelAvailRQ>'
>>> criterion = request.add_criterion()
>>> str(request)
'<OTA_HotelAvailRQ xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_HotelAvailRQ.xsd"><POS><Source><RequestorID/></Source><Source><RequestorID/></Source></POS><AvailRequestSegments><AvailRequestSegment InfoSource="Distribution"><HotelSearchCriteria><Criterion/></HotelSearchCriteria></AvailRequestSegment></AvailRequestSegments></OTA_HotelAvailRQ>'
>>> hotel = hotel_avail.HotelRef('ABCDE123', '1A')
>>> hotel.chain_code = 'AB'
>>> hotel.hotel_city_code = 'CDE'
>>> criterion.add_hotel_ref(hotel)
<HotelRef ChainCode="AB" HotelCityCode="CDE" HotelCode="ABCDE123" HotelCodeContext="1A"/>
>>> hotel = hotel_avail.HotelRef()
>>> hotel.chain_code = 'CD'
>>> criterion.add_hotel_ref(hotel)
<HotelRef ChainCode="CD"/>
>>> str(criterion)
'<Criterion><HotelRef ChainCode="AB" HotelCityCode="CDE" HotelCode="ABCDE123" HotelCodeContext="1A"/><HotelRef ChainCode="CD"/></Criterion>'
>>> str(request)
'<OTA_HotelAvailRQ xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_HotelAvailRQ.xsd"><POS><Source><RequestorID/></Source><Source><RequestorID/></Source></POS><AvailRequestSegments><AvailRequestSegment InfoSource="Distribution"><HotelSearchCriteria><Criterion><HotelRef ChainCode="AB" HotelCityCode="CDE" HotelCode="ABCDE123" HotelCodeContext="1A"/><HotelRef ChainCode="CD"/></Criterion></HotelSearchCriteria></AvailRequestSegment></AvailRequestSegments></OTA_HotelAvailRQ>'

Testing

How do I run the project's automated tests?

./run_tests.sh

opentravel-xml-api's People

Watchers

James Cloos avatar Royendgel Silberie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.