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 = {
    "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",
    "x-swa-di-dtid": "db1c86523c23f01f809ab1b6f6052317e311",
    "x-swa-di-pid": "undefined",
    "x-swa-di-ue": "",
    "x-swa-di-uid": "undefined",
    "x-swa-di-usid": "undefined",
    "x-user-experience-id": '58e15b33-b2b2-4dda-a4c3-1a5317615943'

}

# https://www.southwest.com/assets/app/scripts/swa-common.js
headers.update(
{"ee30zvqlwf-f":"A63T4AeLAQAAsHSJo2oIhv-nEisZ9LRVB8h5AJI8TMFreevFKPIKGXvcN_alASaWDWWucirJwH9eCOfvosJeCA==","ee30zvql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5zCtKiVv6t3enlkEX8kt2TaFK2lGw8y=yaEbD5d2G=5dW6eASUEc2HemKFiOJVpdYmI8JqNvMyAHdyKg3=9gmwNBweSZwK=fKxHZbjUnipmV6W=JDdV14nhXVTs0QqchJzMr61ZwbF6UslPJviubNjTuaTrQbG7=CZVP79ByudRA3aJ1X7HPiM0xKaEVrbJhwNOMHlkt36RIaDVCVRQ3BJWvXIGTtgfU8wgkVAtjBcvk4GW=Boe9eFUDUiVy8Dk168ktDuZIIv1iBtzHXGFV0xn_sWT8eg5HwWbWgwvcMvaKSDMOEwCYEV5E043OlEf06fZrVbijSNIyH59j8AjOv=Cl8QOF65I3s7Wc2cUuN4Tv1lr=ayVKi=WHNe-5zclQGQlU0q5ircptdQs2Uw2=wS9T3qIZMDPokGiYPuVheQ21g5lPFe7fsIKDKv6ASDPOzv8N2B5lEQ1SN4T43DHz_60fU4cH5S0KI79lWOYmBnsM5S3bPqKKpNHkt6m_vGtfYAPua749iiAyToJ=GCNu3Pr4xhb=_SKQUfCaTA3io3DP9J9Kucy4JwhfaAUNIX74UxnPYkKzkgBhspxHHCOnr2kA8ii3en8Znapk3gdaQQNuc905i4tryfwJ0sZPakZecgCyxfYPI6Kmqutb3ZWeMCKNy3kizq3Tve17ZC=KhlI_GNnmgxqx4tAIZqtmuUg=B2t2mBDXDJgEeaggPQgCou7ydMRiwtYleBnHra3HeVqdiYwozSRyobx9AcYl5_A7VbbIx-P0w4w5n6ajDUx9gp-pDjUBcol3T4=ilAYn1GhllWlA5tNjXtME7dIM9fmwKb7HwzNHZz__xMlEUmgib3lQhG17S7c0f5","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"}


)
url = "https://www.southwest.com/api/air-booking/v1/air-booking/page/air/booking/shopping"
data = {
    "adultPassengersCount": "1",
    "adultsCount": "1",
    "departureDate": "2023-09-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)