{"id":1393,"date":"2023-02-03T10:00:22","date_gmt":"2023-02-03T01:00:22","guid":{"rendered":"https:\/\/uapisupport.travelport.co.kr\/?page_id=1393"},"modified":"2023-02-03T11:11:25","modified_gmt":"2023-02-03T02:11:25","slug":"python-soap-client-%ec%83%98%ed%94%8c","status":"publish","type":"page","link":"https:\/\/uapisupport.travelport.co.kr\/?page_id=1393","title":{"rendered":"Python Soap Client \uc0d8\ud50c"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Overview :  A simple example that retrieves flight availability information using the Travelport Universal API (UAPI) in Python:<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \" >import base64\nimport requests\n#import xmltodict\n\nurl = \"https:\/\/apac.universal-api.pp.travelport.com\/B2BGateway\/connect\/uAPI\/AirService\"\n\nauthHeader = base64.b64encode(\n        ('Your Base64 encoded username' + ':' + 'password').encode()).decode()\n\nheaders = {\n    'Content-Type': 'text\/xml; charset=utf-8',\n    'Accept': 'gzip,deflate',\n    'Authorization': 'Basic ' + authHeader\n}\n\nbody = \"\"\"\n&lt;soap:Envelope xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\n  &lt;soap:Body&gt;\n    &lt;air:LowFareSearchReq AuthorizedBy=\"MODETOUREDEV\" TraceId=\"2023020210102121\" TargetBranch=\"P*******\" ReturnUpsellFare=\"false\"  SolutionResult=\"true\" xmlns:air=\"http:\/\/www.travelport.com\/schema\/air_v52_0\" xmlns:com=\"http:\/\/www.travelport.com\/schema\/common_v52_0\"&gt;\n      &lt;com:BillingPointOfSaleInfo OriginApplication=\"uAPI\"\/&gt;\n         &lt;air:SearchAirLeg&gt;\n            &lt;air:SearchOrigin&gt;\n               &lt;com:Airport Code=\"ICN\"\/&gt;\n            &lt;\/air:SearchOrigin&gt;\n            &lt;air:SearchDestination&gt;\n               &lt;com:Airport Code=\"BKK\"\/&gt;\n            &lt;\/air:SearchDestination&gt;\n            &lt;air:SearchDepTime PreferredTime=\"2023-03-22\"\/&gt;\n         &lt;\/air:SearchAirLeg&gt;\n                  \n\n         &lt;air:AirSearchModifiers&gt;\n            &lt;air:PreferredProviders&gt;\n               &lt;com:Provider Code=\"1G\"\/&gt;\n            &lt;\/air:PreferredProviders&gt;\n            \n          &lt;air:FlightType DoubleInterlineCon=\"false\" DoubleOnlineCon=\"false\" SingleInterlineCon=\"false\" SingleOnlineCon=\"true\" StopDirects=\"true\" NonStopDirects=\"true\"\/&gt;\n         &lt;\/air:AirSearchModifiers&gt;\n         &lt;com:SearchPassenger BookingTravelerRef=\"ADT01\" Code=\"ADT\"\/&gt;\n      &lt;com:SearchPassenger BookingTravelerRef=\"CNN01\" Code=\"CNN\" Age=\"8\" \/&gt;\n      &lt;com:SearchPassenger BookingTravelerRef=\"INF01\" Code=\"INF\" Age=\"1\" \/&gt;\n         &lt;air:AirPricingModifiers AccountCodeFaresOnly=\"false\" ETicketability=\"Required\" FaresIndicator=\"AllFares\"&gt;\n         &lt;\/air:AirPricingModifiers&gt;\n      &lt;\/air:LowFareSearchReq&gt;\n   &lt;\/soap:Body&gt;\n&lt;\/soap:Envelope&gt;\n\"\"\"\n\nresponse = requests.post(url, headers=headers, data=body)\n#result = xmltodict.parse(response.text)\n\nprint(response.text)<\/pre><\/div>\n\n\n\n<p>This is a basic example to demonstrate the request and response structure. You&#8217;ll need to replace <code>Your Base64 encoded username:password<\/code> with your actual Travelport UAPI credentials encoded in Base64.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"722\" src=\"https:\/\/uapisupport.travelport.co.kr\/wp-content\/uploads\/2023\/02\/image-1-1024x722.png\" alt=\"\" class=\"wp-image-1398\" srcset=\"https:\/\/uapisupport.travelport.co.kr\/wp-content\/uploads\/2023\/02\/image-1-1024x722.png 1024w, https:\/\/uapisupport.travelport.co.kr\/wp-content\/uploads\/2023\/02\/image-1-300x212.png 300w, https:\/\/uapisupport.travelport.co.kr\/wp-content\/uploads\/2023\/02\/image-1-768x542.png 768w, https:\/\/uapisupport.travelport.co.kr\/wp-content\/uploads\/2023\/02\/image-1.png 1384w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The <code>'Accept': 'gzip,deflate'<\/code> header in an HTTP request is used to specify the preferred response format for the content being requested. The header is used to indicate to the server what encoding format the client would like the response to be in.<\/p>\n\n\n\n<p>The values <code>gzip<\/code> and <code>deflate<\/code> indicate that the client would like the server to compress the response content using the Gzip or Deflate compression algorithms, respectively. The server may choose to compress the content or return it uncompressed, depending on its capabilities and the availability of the specified compression algorithms.<\/p>\n\n\n\n<p>In the context of a Travelport UAPI request, the <code>'Accept': 'gzip,deflate'<\/code> header can be used to indicate that the client would like the response content to be compressed, potentially resulting in faster response times and reduced network traffic.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview : A simple example that retrieves flight availability information using the Travelport Universal API (UAPI) in Python: This is a basic example to demonstrate the request and response structure. You&#8217;ll need to replace Your Base64 encoded username:password with your actual Travelport UAPI credentials encoded in Base64. The &#8216;Accept&#8217;: &#8216;gzip,deflate&#8217; header in an HTTP request &hellip;<br \/><a href=\"https:\/\/uapisupport.travelport.co.kr\/?page_id=1393\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\"><span class=\"screen-reader-text\">Python Soap Client \uc0d8\ud50c<\/span> \ub354\ubcf4\uae30<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1393","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/uapisupport.travelport.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/1393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/uapisupport.travelport.co.kr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/uapisupport.travelport.co.kr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/uapisupport.travelport.co.kr\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/uapisupport.travelport.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1393"}],"version-history":[{"count":6,"href":"https:\/\/uapisupport.travelport.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/1393\/revisions"}],"predecessor-version":[{"id":1404,"href":"https:\/\/uapisupport.travelport.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/1393\/revisions\/1404"}],"wp:attachment":[{"href":"https:\/\/uapisupport.travelport.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}