ó
UX[c           @   s   d  d l  Td  d l Z d  d l m Z d d „ Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z	 d „  Z
 d „  Z d „  Z d Z d „  Z d S(   iÿÿÿÿ(   t   *N(   t   sleept   6B3Dc         C   s•   d } t  j t d | d t ƒ} t j | j ƒ } | d d d j } |  d k rˆ d | d |  d	 } t  j t d | d t ƒ} n  d
 |  GH| S(   NsÓ  
    <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
       <SOAP-ENV:Header>
          <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='1.0'>
             <eb:From>
                <eb:PartyId type='urn:x12.org:IO5:01'>999999</eb:PartyId>
             </eb:From>
             <eb:To>
                <eb:PartyId type='urn:x12.org:IO5:01'>123123</eb:PartyId>
             </eb:To>
             <eb:CPAId>6B3D</eb:CPAId>
             <eb:ConversationId>TEST-6B3D</eb:ConversationId>
             <eb:Service eb:type='OTA'>SessionCreateRQ</eb:Service>
             <eb:Action>SessionCreateRQ</eb:Action>
             <eb:MessageData>
                <eb:MessageId>170390</eb:MessageId>
                <eb:Timestamp>2012-06-07T10:00:00</eb:Timestamp>
                <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
             </eb:MessageData>
          </eb:MessageHeader>
          <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
             <wsse:UsernameToken>
                <wsse:Username>170390</wsse:Username>
                <wsse:Password>WS793581</wsse:Password>
                <Organization>6B3D</Organization>
                <Domain>DEFAULT</Domain>
             </wsse:UsernameToken>
          </wsse:Security>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body>
          <SessionCreateRQ>
             <POS>
                <Source PseudoCityCode='6B3D'/>
             </POS>
          </SessionCreateRQ>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    t   datat   headersi    iÿÿÿÿR   sG   <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
        <SOAP-ENV:Header>
            <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='2.0'>
                <eb:From>
                    <eb:PartyId type='urn:x12.org:IO5:01'>1212</eb:PartyId>
                </eb:From>
                <eb:To>
                    <eb:PartyId type='urn:x12.org:IO5:01'>2323</eb:PartyId>
                </eb:To>
                <eb:CPAId>6B3D</eb:CPAId>
                <eb:ConversationId>TEST-6B3D</eb:ConversationId>
                <eb:Service eb:type='OTA'>ContextChangeLLSRQ</eb:Service>
                <eb:Action>ContextChangeLLSRQ</eb:Action>
                <eb:MessageData>
                    <eb:MessageId>1001</eb:MessageId>
                    <eb:Timestamp>2012-06-07T10:00:01</eb:Timestamp>
                    <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
                </eb:MessageData>
            </eb:MessageHeader>
            <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
                <wsse:BinarySecurityToken valueType='String' EncodingType='wsse:Base64Binary'>sQ  </wsse:BinarySecurityToken>
            </wsse:Security>
        </SOAP-ENV:Header>
        <SOAP-ENV:Body>
            <ContextChangeRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.3">
    <ChangeAAA PseudoCityCode='sQ   '/>
    </ContextChangeRQ>
        </SOAP-ENV:Body>
        </SOAP-ENV:Envelope> s   Session started ... (   t   requestst   postt   urlR   t   ETt
   fromstringt   contentt   text(   t   pccToEmulatet   bodyt   responset   roott   secToken(    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt   start_session   s    '	c         C   s5   d |  d } t  j t d | d t ƒ} d GH| j S(   Ns   <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
       <SOAP-ENV:Header>
          <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='2.0'>
             <eb:From>
                <eb:PartyId type='urn:x12.org:IO5:01'>1212</eb:PartyId>
             </eb:From>
             <eb:To>
                <eb:PartyId type='urn:x12.org:IO5:01'>2323</eb:PartyId>
             </eb:To>
             <eb:CPAId>6B3D</eb:CPAId>
             <eb:ConversationId>TEST-6B3D</eb:ConversationId>
             <eb:Service eb:type='OTA'>SessionCloseRQ</eb:Service>
             <eb:Action>SessionCloseRQ</eb:Action>
             <eb:MessageData>
                <eb:MessageId>1001</eb:MessageId>
                <eb:Timestamp>2012-06-07T10:00:01</eb:Timestamp>
                <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
             </eb:MessageData>
          </eb:MessageHeader>
          <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
             <wsse:BinarySecurityToken valueType='String' EncodingType='wsse:Base64Binary'>s'  </wsse:BinarySecurityToken>
          </wsse:Security>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body>
          <SessionCloseRQ>
             <POS>
                <Source PseudoCityCode='6B3D'/>
             </POS>
          </SessionCloseRQ>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope> R   R   s   Session stopped ...(   R   R   R   R   R
   (   R   R   R   (    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt   stop_session\   s
    
c         C   sX   t  ƒ  d |  d | d } t j t d | d t ƒ} t d | | j ƒ d GH| j S(   Ns   <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
       <SOAP-ENV:Header>
          <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='2.0'>
             <eb:From>
                <eb:PartyId type='urn:x12.org:IO5:01'>1212</eb:PartyId>
             </eb:From>
             <eb:To>
                <eb:PartyId type='urn:x12.org:IO5:01'>2323</eb:PartyId>
             </eb:To>
             <eb:CPAId>6B3D</eb:CPAId>
             <eb:ConversationId>TEST-6B3D</eb:ConversationId>
             <eb:Service eb:type='OTA'>eTicketCouponLLSRQ</eb:Service>
             <eb:Action>eTicketCouponLLSRQ</eb:Action>
             <eb:MessageData>
                <eb:MessageId>1001</eb:MessageId>
                <eb:Timestamp>2012-06-07T10:00:01</eb:Timestamp>
                <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
             </eb:MessageData>
          </eb:MessageHeader>
          <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
             <wsse:BinarySecurityToken valueType='String' EncodingType='wsse:Base64Binary'>sR  </wsse:BinarySecurityToken>
          </wsse:Security>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body>
          <eTicketCouponRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.0">
            <Ticketing eTicketNumber='sP   '/>
        </eTicketCouponRQ>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope> R   R   s   ticket/s   eTicket Retrieved ...(   t   logR   R   R   R   t   myprintR
   (   R   t   doc_noR   R   (    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt   ticket…   s    c         C   sg   t  ƒ  d | d |  d } t j t d | d t ƒ} d GHt d t t j j ƒ  ƒ | j	 ƒ | j	 S(   Ns  
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
       <SOAP-ENV:Header>
          <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='1.0'>
             <eb:From>
                <eb:PartyId type='urn:x12.org:IO5:01'>999999</eb:PartyId>
             </eb:From>
             <eb:To>
                <eb:PartyId type='urn:x12.org:IO5:01'>123123</eb:PartyId>
             </eb:To>
             <eb:CPAId>6B3D</eb:CPAId>
             <eb:ConversationId>TEST-6B3D</eb:ConversationId>
             <eb:Service eb:type='OTA'>QueueCountLLSRQ</eb:Service>
             <eb:Action>QueueCountLLSRQ</eb:Action>
             <eb:MessageData>
                <eb:MessageId>170390</eb:MessageId>
                <eb:Timestamp>2012-06-07T10:00:00</eb:Timestamp>
                <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
             </eb:MessageData>
          </eb:MessageHeader>
          <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
             <wsse:BinarySecurityToken valueType='String' EncodingType='wsse:Base64Binary'>sO  </wsse:BinarySecurityToken>
          </wsse:Security>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body>
           <QueueCountRQ xmlns='http://webservices.sabre.com/sabreXML/2011/10' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' Version='2.2.0'>
<QueueInfo>
<QueueIdentifier Number='sh   ' PseudoCityCode='6B3D'/>
</QueueInfo>
</QueueCountRQ>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
R   R   s   Queue Count Dones   QC/(
   R   R   R   R   R   R   t   strt   datetimet   nowR
   (   t   queue_numberR   R   R   (    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt   queue_count°   s    !#c         C   so   t  ƒ  d | d |  d | d } t j t d | d t ƒ} d GHt d t t j j ƒ  ƒ | j	 ƒ | j	 S(	   Ns  
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
       <SOAP-ENV:Header>
          <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='1.0'>
             <eb:From>
                <eb:PartyId type='urn:x12.org:IO5:01'>999999</eb:PartyId>
             </eb:From>
             <eb:To>
                <eb:PartyId type='urn:x12.org:IO5:01'>123123</eb:PartyId>
             </eb:To>
             <eb:CPAId>6B3D</eb:CPAId>
             <eb:ConversationId>TEST-6B3D</eb:ConversationId>
             <eb:Service eb:type='OTA'>QueueAccessLLSRQ</eb:Service>
             <eb:Action>QueueAccessLLSRQ</eb:Action>
             <eb:MessageData>
                <eb:MessageId>170390</eb:MessageId>
                <eb:Timestamp>2012-06-07T10:00:00</eb:Timestamp>
                <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
             </eb:MessageData>
          </eb:MessageHeader>
          <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
             <wsse:BinarySecurityToken valueType='String' EncodingType='wsse:Base64Binary'>sL  </wsse:BinarySecurityToken>
          </wsse:Security>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body>
       <QueueAccessRQ xmlns='http://webservices.sabre.com/sabreXML/2011/10' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' Version='2.0.7'>
            <QueueIdentifier Number='s   ' PseudoCityCode='s   '>
                <List Ind="true"/>
            </QueueIdentifier>
        </QueueAccessRQ>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
R   R   s   Queue Access Dones   qa/(
   R   R   R   R   R   R   R   R   R   R
   (   R   R   R   R   R   (    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt   queue_accessÞ   s     #c         C   s3   t  ƒ  t t ƒ } t |  | d ƒ } t | ƒ | S(   Nt   test(   R   R   R   t   get_pnrR   (   t   pnrt   tt   x(    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt   pnr_get  s
    
c         C   sX   t  ƒ  d | d |  d } t j t d | d t ƒ} t d | | j ƒ d GH| j S(   Ns  
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
       <SOAP-ENV:Header>
          <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='1.0'>
             <eb:From>
                <eb:PartyId type='urn:x12.org:IO5:01'>999999</eb:PartyId>
             </eb:From>
             <eb:To>
                <eb:PartyId type='urn:x12.org:IO5:01'>123123</eb:PartyId>
             </eb:To>
             <eb:CPAId>6B3D</eb:CPAId>
             <eb:ConversationId>TEST-6B3D</eb:ConversationId>
             <eb:Service eb:type='OTA'>TravelItineraryReadRQ</eb:Service>
             <eb:Action>TravelItineraryReadRQ</eb:Action>
             <eb:MessageData>
                <eb:MessageId>170390</eb:MessageId>
                <eb:Timestamp>2012-06-07T10:00:00</eb:Timestamp>
                <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
             </eb:MessageData>
          </eb:MessageHeader>
          <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
             <wsse:BinarySecurityToken valueType='String' EncodingType='wsse:Base64Binary'>s7  </wsse:BinarySecurityToken>
          </wsse:Security>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body>
            <TravelItineraryReadRQ xmlns='http://services.sabre.com/res/tir/v3_8' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' TimeStamp='2014-12-16T16:00:00-06:00' Version='3.8.0'>
                <MessagingDetails>
                    <SubjectAreas>
                        <SubjectArea>FULL</SubjectArea>
                    </SubjectAreas>
                </MessagingDetails>
                <UniqueID ID='s”   '/>
                <ReturnOptions UnmaskCreditCard='false'/>
            </TravelItineraryReadRQ>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
R   R   s   tir/s   Itinerary Read Done(   R   R   R   R   R   R   R
   (   R   R   t   filenameR   R   (    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyR     s    %c         C   sP   t  ƒ  d |  d } t j t d | d t ƒ} d GHt d | | j ƒ | j S(   Ns  
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
       <SOAP-ENV:Header>
          <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='1.0'>
             <eb:From>
                <eb:PartyId type='urn:x12.org:IO5:01'>999999</eb:PartyId>
             </eb:From>
             <eb:To>
                <eb:PartyId type='urn:x12.org:IO5:01'>123123</eb:PartyId>
             </eb:To>
             <eb:CPAId>6B3D</eb:CPAId>
             <eb:ConversationId>TEST-6B3D</eb:ConversationId>
             <eb:Service eb:type='OTA'>DisplayPriceQuoteLLSRQ</eb:Service>
             <eb:Action>DisplayPriceQuoteLLSRQ</eb:Action>
             <eb:MessageData>
                <eb:MessageId>170390</eb:MessageId>
                <eb:Timestamp>2012-06-07T10:00:00</eb:Timestamp>
                <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
             </eb:MessageData>
          </eb:MessageHeader>
          <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
             <wsse:BinarySecurityToken valueType='String' EncodingType='wsse:Base64Binary'>sù  </wsse:BinarySecurityToken>
          </wsse:Security>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body>
            <DisplayPriceQuoteRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.5.0">
                <AirItineraryPricingInfo>
                    <Record/>
                </AirItineraryPricingInfo>
            </DisplayPriceQuoteRQ>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
R   R   s   PriceQuote Dones   pq/PQ_(   R   R   R   R   R   R   R
   (   R   R#   R   R   (    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt	   get_priceM  s    c         C   s  t  ƒ  t t ƒ } d | d | d | d |  d | d } t j t d | d t ƒ} t | ƒ t j	 | ƒ } t j	 | j
 ƒ } | d d } | d }	 |	 d	 }
 |
 d	 } |
 d
 } | j d ƒ } | j d ƒ } | d	 j d ƒ } | d	 j d ƒ } | | | | g S(   NsY   <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
           <SOAP-ENV:Header>
              <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='2.0'>
                 <eb:From>
                    <eb:PartyId type='urn:x12.org:IO5:01'>1212</eb:PartyId>
                 </eb:From>
                 <eb:To>
                    <eb:PartyId type='urn:x12.org:IO5:01'>2323</eb:PartyId>
                 </eb:To>
                 <eb:CPAId>6B3D</eb:CPAId>
                 <eb:ConversationId>TEST-6B3D</eb:ConversationId>
                 <eb:Service eb:type='OTA'>OTA_AirFlifoLLSRQ</eb:Service>
                 <eb:Action>OTA_AirFlifoLLSRQ</eb:Action>
                 <eb:MessageData>
                    <eb:MessageId>1001</eb:MessageId>
                    <eb:Timestamp>2012-06-07T10:00:01</eb:Timestamp>
                    <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
                 </eb:MessageData>
              </eb:MessageHeader>
              <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
                 <wsse:BinarySecurityToken valueType='String' EncodingType='wsse:Base64Binary'>sy  </wsse:BinarySecurityToken>
              </wsse:Security>
           </SOAP-ENV:Header>
           <SOAP-ENV:Body>
           <OTA_AirFlifoRQ xmlns='http://webservices.sabre.com/sabreXML/2011/10' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' Version='2.0.0'>
<OriginDestinationInformation>
<FlightSegment DepartureDateTime='s   ' FlightNumber='s   '>
<MarketingAirline Code='s   '/>
</FlightSegment>
</OriginDestinationInformation>
</OTA_AirFlifoRQ>

           </SOAP-ENV:Body>
        </SOAP-ENV:Envelope> R   R   iÿÿÿÿi    i   t   LocationCodet	   Scheduled(   R   R   R   R   R   R   R   R   t   etreet   XMLR
   t   get(   t   airline_codet   flight_numbert   dtR    R   R   t   rR   R!   t
   flightinfot   scheduledinfot   origint   destinationt   ot   dt   dep_timet   arr_time(    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt   get_airline_details|  s$    #'




t    c   #      C   sÔ  t  ƒ  t t ƒ } d | d t |  ƒ d } d GHt j t d | d t ƒ} t | ƒ t	 j
 | j ƒ } | d d d } t	 j | d	 t ƒGHt	 j | d	 t ƒ} | j d
 ƒ } t d | | ƒ g  }	 x| d D]õ}
 |
 j d ƒ } | j ƒ  d t | j ƒ  ƒ } g  } d } xz| g  k r”| j ƒ  } | j ƒ  } | j ƒ  d } d } y/| j ƒ  } | GH| d k rŒ| d } | d } n÷ | j ƒ  r€| j ƒ  } t | ƒ d k rÅ| j ƒ  } n  | j ƒ  } | j ƒ  } t | j ƒ  ƒ } | j ƒ  } | j ƒ  } | j ƒ  } | j ƒ  } | j ƒ  } | j ƒ  }  | j ƒ  }! d }" | j | | | | | | | | | |" | | | g ƒ n wWqqqXqWy- | | d d <| | d d <|	 j | ƒ Wq× q× Xq× W|	 S(   Ns»  <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
               <SOAP-ENV:Header>
                  <eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='2.0'>
                     <eb:From>
                        <eb:PartyId type='urn:x12.org:IO5:01'>1212</eb:PartyId>
                     </eb:From>
                     <eb:To>
                        <eb:PartyId type='urn:x12.org:IO5:01'>2323</eb:PartyId>
                     </eb:To>
                     <eb:CPAId>6B3D</eb:CPAId>
                     <eb:ConversationId>TEST-6B3D</eb:ConversationId>
                     <eb:Service eb:type='OTA'>SabreCommandLLSRQ</eb:Service>
                     <eb:Action>SabreCommandLLSRQ</eb:Action>
                     <eb:MessageData>
                        <eb:MessageId>1001</eb:MessageId>
                        <eb:Timestamp>2012-06-07T10:00:01</eb:Timestamp>
                        <eb:TimeToLive>2013-06-06T23:59:59</eb:TimeToLive>
                     </eb:MessageData>
                  </eb:MessageHeader>
                  <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext'
                   xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
                     <wsse:BinarySecurityToken valueType='String' EncodingType='wsse:Base64Binary'>s´  </wsse:BinarySecurityToken>
                  </wsse:Security>
               </SOAP-ENV:Header>
        <SOAP-ENV:Body><SabreCommandLLSRQ xmlns='http://webservices.sabre.com/sabreXML/2003/07'
        xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        TimeStamp='2014-03-04T14:00:00' Version='1.8.1'>
            <Request Output='SCREEN' CDATA='true'>
                <HostCommand>s„   </HostCommand></Request>
                </SabreCommandLLSRQ>
                </SOAP-ENV:Body>
                </SOAP-ENV:Envelope> t   DingR   R   iÿÿÿÿi    t   pretty_prints   ITINERARY OPTION s   alt/ALT_i   s   
s   Fare R7   t   TOTALi   i   i   (   R   R   R   R   R   R   R   R   R   R'   R(   R
   t   tostringt   Truet   splitR   t   reverset   popt   isdigitt   lent   m_datet   append(#   t   sttR   R    R   R   R   t   yR!   t   partst   resultst   partt   pst   fareidt   resultt   checkt   segmentt   infost   faret   currencyt   checkkt   t_faret
   t_currencyt   marketing_airline_codet   op_airline_codeR+   t   rbdt   dep_datet   day_weekR0   R1   R4   R5   t	   equipmentt   stopovert
   fare_basis(    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt   alternate_fareÁ  sŽ    "



(   t   helpert   pdbt   timeR   R   R   R   R   R   R"   R   R$   R6   t   current_timeR\   (    (    (    s6   /mnt/c/Users/Mahat/Documents/tripnomics-1.2/py/defs.pyt   <module>   s   
V	)	+	.	1		6	/	B