import requests
import json
import tls_client

session = tls_client.Session(client_identifier='chrome_112')
proxy = 'http://127.0.0.1:7890'
session.proxies = {
    'http': proxy,
    'https': proxy,
}
headers = {
    "Accept": "application/json, text/plain, */*",
    "Accept-Language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6",
    "Cache-Control": "no-cache",
    "Connection": "keep-alive",
    "Content-Type": "application/json",
    "Origin": "https://www.westjet.com",
    "Pragma": "no-cache",
    "Referer": "https://www.westjet.com/",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-site",
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
    "X-Lov30h0l-z": "q",
    "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"macOS\""
}
headers.update(
{"x-lov30h0l-f":"A5OVa72KAQAAIDcLQW1nEFGUwLR3HPXjnigoB6PmLDrIhDfn5RdxAHwwmbN8ASaWDWWuchRAwH9eCOfvosJeCA==","x-lov30h0l-b":"-b12bso","x-lov30h0l-c":"AIChZ72KAQAAr1NAo497FxS1NjOBwtWfTV1_oTHV2xsVJqFALqZGrGXlHScc","x-lov30h0l-d":"ABaAhIDBCKGFgQGAAYIQgISigaIAwBGAzvpCzi_33wemRqxl5R0nHAAAAAAb71NqADUc4ApEGR1UXg33rdPLmMw","x-lov30h0l-z":"q","x-lov30h0l-a":"w_j=UTx_z-lQ2LYTBgDYCb5Yy7aLPRPJNCwoc4=bhp9SH5H7z4T9px5bAJX8Z-NY8c7IXDPkmIFMG7zleGDiM0L6e7tHWBk08SODhjcRcjvEiiz9eQDv47jm2Pt7f0tSSSWS4nkFfOKjFC4C5uWA3_JacdNaBQ5EIjINMRW_3lL3nWOysVzbPH7XO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id7W6aBCGSaScD7LLGytO4_UTBIAMUNcT8w5-HrxnwT=r4sdcew7q9JIZeVqP9m8A9AMLWlRZS5qmaiOvw2n9l5KW0d9F-47=t7R8KNUGhuWtHOfWHkI--9jVTHmHy9BDP3gA6T=UgGMBPe5LwBUxkKhDRtHgeauFlXB8FBIDgyJnV5PJa49Z-Q9sm4w85atn=y_48ZinJe2ZAeFcRch-aGYr4AwDa4HKdK_g6Vg49BzNj2eosul2yhXQr4nEdItDhTMzn2RUAxYKPNuLExe6lbkr4628yHvccck=xbu0zloVvF2oVHmbk5BCLem5If7Hv7vxMWskUUqlQWjVK9bcHHP0peKP5bi=h8ls8o3tZ0hVmU3=erdkcyk4wdy92qbKfqXrE0jscWpVtHsvw0JcP72ZHtei","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"}


)
url = "https://apiw.westjet.com/ecomm/booktrip/flight-search-api/v1"
data = {
    "appSource": "3rdparty:OW",
    "bookId": "22-9-2023-15-4-21-14609",
    "currency": "CAD",
    "currentFlightIndex": 1,
    "guests": [
        {
            "type": "adult",
            "count": "1"
        },
        {
            "type": "child",
            "count": "0"
        },
        {
            "type": "infant",
            "count": "0"
        }
    ],
    "promoCode": "",
    "showMemberExclusives": False,
    "trips": [
        {
            "order": 1,
            "departure": "SMF",
            "arrival": "YQR",
            "departureDate": "2023-09-22"
        }
    ]
}
data = json.dumps(data, separators=(',', ':'))
response = session.post(url, headers=headers, data=data)

print(response.text)
print(response)