-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_amadeus_soap.py
54 lines (48 loc) · 1.58 KB
/
test_amadeus_soap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
import base64
from constants import *
import zeep
if __name__ == "__main__":
client = zeep.Client(wsdl=WSDL1)
# authenticate
resp = client.service.Security_Authenticate(
userIdentifier={
"originIdentification": {
"sourceOffice": SOURCEOFFICE
},
"originatorTypeCode": "U",
"originator": USERNAME
},
passwordInfo={
"dataLength": str(len(PASSWORD)),
"dataType": "E",
"binaryData": base64.b64encode(PASSWORD)
},
dutyCode={
"dutyCodeDetails" : {
"referenceQualifier": "DUT",
"referenceIdentifier": "SU"
}
}
)
session = resp["header"]["session"]
headers = {"session": session}
# JBU 1012: JetBlue Chicago to Boston
print client.service.Air_FlightInfo(generalFlightInfo={
"companyDetails": {
"marketingCompany": "B6" # IATA airline code
},
"flightIdentification": {
"flightNumber": "1012"
},
"flightDate": {
"departureDate": "110118" # ddmmyy
},
"boardPointDetails": {
"trueLocationId": "ORD"
},
"offPointDetails": {
"trueLocationId": "BOS"
}
}, _soapheaders=headers)
client.service.Security_SignOut(_soapheaders=headers)