import requests
import json
import tls_client

session = tls_client.Session(client_identifier='chrome_117', random_tls_extension_order=True)
proxy = 'http://127.0.0.1:7890'
session.proxies = {
    'http': proxy,
    'https': proxy,
}
headers = {
    "authority": "www.southwest.com",
    "accept": "application/json, text/javascript, */*; q=0.01",
    "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",
    "content-type": "application/json",
    "origin": "https://www.southwest.com",
    "pragma": "no-cache",
    "referer": "https://www.southwest.com/air/booking/select.html?int=HOMEQBOMAIR&adultPassengersCount=1&departureDate=2023-09-21&destinationAirportCode=LAX&fareType=USD&originationAirportCode=LAS&passengerType=ADULT&promoCode=&returnDate=2023-09-24&tripType=roundtrip&from=&to=&adultsCount=1&departureTimeOfDay=ALL_DAY&reset=true&returnTimeOfDay=ALL_DAY",
    "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\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "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-api-key": "l7xx944d175ea25f4b9c903a583ea82a1c4c",
    "x-app-id": "air-booking",
    "x-channel-id": "southwest",

}

# https://www.southwest.com/assets/app/scripts/swa-common.js
headers.update(
    {'ee30zvqlwf-f': 'A21AQYuMAQAAREt8k9aDBq0UscBwaXPPqZMR043APDSSl4pW7M653mFTcUgYAS4D8lMAAAAAAAAAAAAAAAAAAA==',
     'ee30zvqlwf-b': '-shm5q2', 'ee30zvqlwf-c': 'AADVPouMAQAAIhxitqfr62EZPQ1Q_mqaZ_ul5pJM7x5YMAbSAJ-8i9GvNzy-',
     'ee30zvqlwf-d': 'ABaAhIDBCKGFgQGAAYIQgISig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HItC_sMS=BBnFMfzT8aMLFaxWdUPRXQgaNiBAD8nZs-wgIgLWcFKaw4HzpKX1PJSKNO5Lbd=Yscu3VYXtAZQ-VPDdRCSGDmse1oEe9N5HIze=G6enYx2gWlp-TnGS_RrSnMiCkqcRFFdAhHQGnM_pTZTMCRxbefEUUyUkW_XIlIxLt_D9vhk7Akyv7ApvusTjJ637PX6M54tTZa-R5IwejFZ8vWjoRd35SIROgoHLXhlW77J84JUoz2tJT1KoSLb7koumVXcf5pIYLsh7UyzyUkrosf6DzCFbMpq6e24Bn2KALf41sRlGxTJIL7nYVDl--w4CkTdRFcb1Bz45kBwHDeokqijfM7=qmVCS1EcHiz_zNXR76udivtgouz1gdp9fDBYxUyIqBgrS7SwtLdvMcMrbzWA_nUeSEJ3lpiQB1K1NfJJJBX=cD1kuxrAuIMcSe_pFfJZHnjL-Ofa66AovtrIJSK-PFP1EDMA2z8ziaLrUq6FsDgeeTPn-whUBSI9xqOfYH9U4nKGWsWg2en54Z_Z1xvrZNHBQX9orOhbwApL86vZ8_6SwtPxS7X6W5LzVg=mzqUVwFgR',
     'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 SLBrowser/8.0.1.5162 SLBChan/103'}

)
url = "https://www.southwest.com/api/air-booking/v1/air-booking/page/air/booking/shopping"
data = {
    "adultPassengersCount": "1",
    "adultsCount": "1",
    "departureDate": "2023-12-22",
    "departureTimeOfDay": "ALL_DAY",
    "destinationAirportCode": "LAX",
    "fareType": "USD",
    "from": "",
    "int": "HOMEQBOMAIR",
    "originationAirportCode": "LAS",
    "passengerType": "ADULT",
    "promoCode": "",
    "reset": "true",
    "returnDate": "2023-08-24",
    "returnTimeOfDay": "ALL_DAY",
    "to": "",
    "tripType": "roundtrip",
    "application": "air-booking",
    "site": "southwest"
}
data = json.dumps(data, separators=(',', ':'))
response = session.post(url, headers=headers, data=data)

print(response.text)
print(response)
