import requests
import json
import time

headers = {
    "Host": "www.southwest.com",
    "x-user-experience-id": "9f32a51e-c800-4b25-b9df-08b380a4b011",
    "authorization": "null null",
    "x-api-idtoken": "null",
    "sec-ch-ua-platform": "\"macOS\"",
    "x-channel-id": "southwest",
    "x-app-id": "air-booking",
    "sec-ch-ua-mobile": "?0",
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",
    "content-type": "application/json",
    "accept": "application/json, text/javascript, */*; q=0.01",
    "x-api-key": "l7xx944d175ea25f4b9c903a583ea82a1c4c",
    "origin": "https://www.southwest.com",
    "sec-fetch-site": "same-origin",
    "sec-fetch-mode": "cors",
    "sec-fetch-dest": "empty",
    "referer": "https://www.southwest.com/air/booking/select.html?adultPassengersCount=1&adultsCount=1&departureDate=2023-07-13&departureTimeOfDay=ALL_DAY&destinationAirportCode=BOS&fareType=POINTS&int=HOMEQBOMAIR&originationAirportCode=LAS&passengerType=ADULT&reset=true&returnDate=&returnTimeOfDay=ALL_DAY&tripType=oneway",
    "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7"
}

t1 = time.time()
r   = {
    "sec-ch-ua": "\"Chromium\";v=\"112\", \"Google Chrome\";v=\"112\", \"Not:A-Brand\";v=\"99\"",
    "EE30zvQLWf-a": "N0o1dKGE3CQx6-GKMzR4rtouSIvGBU0SMlXHLblfyz_KHqs=Be6bs=o7nxpe7u1=6unACUmZX61dqMyH4MEbZaPswmfmuxEjl=ryRLWk-oqU908OoleSQzCGaH1vfl-W7m4zXbUnPhiWD6luOHW0X6mS_SsPRVn6OYGXMva1psKNPWviLdt2V_YZvGSHFMnBe4bhxNk6uAXqUhKQwhlfDfSN=NymLzRqN-N04RvdQE5iEC5yN7dVtIfFe0aVt=QJy-9oj3i5GaxFonO69WavqvzChSRHuuS6pq8Dx6gjyy=GG669NDGr0rxjGOrdJ4uX2HC-QXx0S-bI0Z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YJCI4xr0EQImP8tQA2ZWIrqpWkHUQbw26-e3bIAH-irrqtmMuJcFZ7XVwuwec9oq-PfmC3OMB0HpXtPN5vnzfC-Mu1QyMyuQdeXMfR3V=kMeByE9U1339XCtWHeaL2gH1FEcNU_3l7MVhBUiCisQeQomfixyy=N=HkzMM0pQ6cYuV5ONrBfnm0pz0PAly7AUBxsuE8ywJiiQ-6WYalldskuO05C4J8Qq8dP3LEjep4Mne-qnV3voaLWc09ofzl=SL8ln5sXdyAi80n0rJjhFBDccFt4cjrPymH0HE6rH0fIDw-wEwW2noxg2x8__sl7pR9S0JbFXoQKR5RCcfOoh5a_P476PaLW=R5wrP4NHD-n9sb",
    "EE30zvQLWf-z": "q",
    "sec-ch-ua-mobile": "?0",
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",
    "EE30zvQLWf-b": "-ntu4jq",
    "Content-Type": "text/plain;charset=UTF-8",
    "EE30zvQLWf-d": "ABaChIjBDKGNgUGAQZIQhISi0eIApJmBDgDkapxi2jdlhP____-c1sW-AMbw7ooMg7NqFwz0R5MpGoc",
    "Referer": "",
    "EE30zvQLWf-c": "AKBBdRCIAQAAz4Uwquo2h4gyuGt2lMzpV2EK3mHXmvclcTyS-eRqnGLaN2WE",
    "EE30zvQLWf-f": "A2iAeRCIAQAAT5srQTpvdAPDkqdULuTzzaBmwBVXI_Dp9Q1sY0R5B_CIq4SwAT3gXZuuchZ2wH8AAOfvAAAAAA==",
    "sec-ch-ua-platform": "\"macOS\""
}

r  =  {
        'ee30zvqlwf-f': 'A7BcPxmIAQAAX_87deQmX9d9wSoD6ivvefVGI2iYMrvmgHuTdm_e_C70bVW3AdIDnZauchZ2wH8AAOfvAAAAAA==',
        'ee30zvqlwf-b': 'bquhjx',
        'ee30zvqlwf-c': 'AEDgPBmIAQAAwzFO0rWyyOOSJIGbmXjRaVDIivb6RsyTe3MegTNL64awl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ic8OgW06IRiMTuZyRrrhApcNgkV-mcZ6riPH18QXQTvMbVAo2vcLF3O7lUy60tCizt3-yR-7PFfRIW0QGNHNi583pjx0XrttUzchWbF8-OgZddw_KEX-ReT-_ft-dfnaEF3Co7J4GUNsDLJDfMOCsnk-aoBnFWsWQDuldvdfG2K1Jqen=Gb7QBecoWUb3zNCqcD-qoX7NUH4geEulnXFJk_onOAyIsVGlxER=6ZrvH-65QDMzTRyHBjmTZNKzvjqVEtU8jt8E4fqxR0ezJytu1HUsKYQix2qAuh1PPm=gRaUg4JFzU281W28T-DNzAAVP2fYwA5_lf6wiXAzJotXL7kNUu=CJyJh-MvZ4HEtFhziNVjYuY3dNxDCVue8B6959IWT3HfGjZc1rytY2pF8MI1RO7=xX_saboXvrI1Bu53WZ=-sFf419c1boiNFxsEuCD29jIYsCijTvTEFEMt60ZsGOyWGayafFb7pVb4__jvAuN10MbXpABFUci4JgAIiKyzq_utQTmiUJ2wau1HFtv74agDHtB79mk8x7WjAiL618XOAuWEacX3ukIlDjVODaingyY20QQ9KxYG88VkOzvBF7CDYIg1KQWkrymbnUpkIlIEoetFpXOW_IDGT8KDNJI5Va-nOtkI4rHuL6OwsfT6pKtWqBajJKZOHdDGwksjflC6PN2GPrurHNotL2Gc4eGXOQEVUb8HBtn08EoDZrlG1WjPkOAEGEsg_G0vVDsgoQdsbUBeGMH-EGsRC4F2rTQ3YlJluN=JXRG3riLVh=kto7_HInBGrh5927X4rqGVEfzh8s_7xAXJHuY-Pr=knLrKMgiK1rWyCRK-wjbit6g8XMyT84Oyrv4sLv4JAVOCI5=iBrrwUKFlbV6gmUglhVTAsRwJOqA'

}




r = requests.get('http://127.0.0.1:3000').json()



print(r)

print(len(r['ee30zvqlwf-a']))

headers.update(r)
cookies = {
    # "swa_FPID": "979f55f3-3505-4286-b5ae-ffa57f781e9c",
    # "PIM-SESSION-ID": "r0oQ3eThtpuj8xnh",
    # "akacd_PIM-prd_ah_rollout": "3860618795~rv=34~id=529740719b41df7d578fb1c734df575b",
    # "at_check": "true",
    # "AMCVS_65D316D751E563EC0A490D4C%40AdobeOrg": "1",
    # "s_ecid": "MCMID%7C38608080011084723602059661987147614374",
    # "s_cc": "true",
    # "nmstat": "09922a4e-6c23-b688-7043-f7e4ef8fd137",
    # "_mibhv": "anon-1683166002770-9292342780_4971",
    # "_up": "1.2.1441922756.1683166051",
    # "QSI_HistorySession": "https%3A%2F%2Fwww.southwest.com%2Fair%2Fbooking%2Findex.html%3FadultPassengersCount%3D1%26adultsCount%3D1%26departureDate%3D2023-05-05%26departureTimeOfDay%3DALL_DAY%26destinationAirportCode%3DLAS%26fareType%3DUSD%26from%3D%26int%3DHOMEQBOMAIR%26originationAirportCode%3DBOS%26passengerType%3DADULT%26promoCode%3D%26reset%3Dtrue%26returnDate%3D%26returnTimeOfDay%3DALL_DAY%26to%3D%26tripType%3Doneway%26validate%3Dtrue~1683166057541%7Chttps%3A%2F%2Fwww.southwest.com%2Fair%2Fbooking%2Findex.html%3FadultPassengersCount%3D1%26adultsCount%3D1%26departureDate%3D2023-05-27%26departureTimeOfDay%3DALL_DAY%26destinationAirportCode%3DLAS%26fareType%3DUSD%26int%3DHOMEQBOMAIR%26originationAirportCode%3DBOS%26passengerType%3DADULT%26reset%3Dtrue%26returnDate%3D%26returnTimeOfDay%3DALL_DAY%26tripType%3Doneway%26validate%3Dtrue~1683193032649",
    # "AMCV_65D316D751E563EC0A490D4C%40AdobeOrg": "1176715910%7CMCIDTS%7C19490%7CMCMID%7C38608080011084723602059661987147614374%7CMCAAMLH-1684464095%7C11%7CMCAAMB-1684464095%7CRKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCOPTOUT-1683866495s%7CNONE%7CMCAID%7CNONE%7CvVersion%7C5.4.0",
    # "X-AK-PIM-INJECT": "sync",
    # "weiygrety": "CCZfHKo6",
    # "sRpK_XA_swc": "%7B%22_rt%22%3A%22DQM3F%2FlXkinE8CmqnymaredHUrCQ3ACk7UkW4jjI0vA%3D%22%2C%22_fr%22%3A20000%2C%22c%22%3A%22aTRzT0JNSng5SUNMTXlQdg%3D%3DzFQWN_z1f8OSxci89H5pjkM69h4eoilYo9djU-MobgbVu8Oq5fNvZLmCwWL22wxjzT6eeX9V1RaBBehKtuuQq7y-Hw5_yVTQtTqHO7a5wYkc5lA%3D%22%2C%22dc%22%3A%22102%22%2C%22mf%22%3A0%2C%22fr%22%3A%22ynVPTJn3OPNk6d4jppxwcg%3D%3DpJ9fKwW9L6YvZhoXBL532NzA1cKCdOnOYyxm8JJe4r852eD4zVnTr1Z5mH1nf-ltZuv0uvQwVmll1EotUoEq686NVCXah4kM0jQ1SMONr4tKcEw%3D%22%2C%22ct%22%3A%22N0xqfP9dvTHN%2FDf8tmCks8VeBP%2BV4BCh1nwA8E4%3D%22%7D",
    # "sRpK8nqm_sc": "A7jdguSHAQAAvGAV4-pBus2_QMHAbjyCMQPtXSF3ZLx0OTg9nNCmPQ2f1PC4AS0rIPCuchZ2wH8AAOfvAAAAAA|1|1|dbbde5436776cb4ede26634196258aef6eb75b3a",
    # "valid_promo": "false",
    # "akavpau_prd_non_vision": "1683861974~id=cf4ad2656adf247dcc90f8be173d5b8b",
    # "s_gpv_pn": "BOOK%3AAIR%3APlan%20Trip%20Page",
    # "RT": "\"z=1&dm=southwest.com&si=f0f36887-7d75-406b-a966-d0fedf492c24&ss=lhjzl3dj&sl=1&tt=1&bcn=%2F%2F684d0d43.akstat.io%2F\"",
    # "akavpau_prd_rogue_api": "1683862274~id=ef05250d45fab128362eb90a479f12b3",
    # "akavpau_prd_air_booking": "1683863134~id=4923d5208366ca09c3a5499fb74eb5e4",
    # "mbox": "PC#bafdf1525d6e4a36be6240ba96165263.32_0#1747107335|session#2ffd9bdfaffd4341b552e1c0a670610b#1683864395",
    # "s_sq": "swaprod%3D%2526c.%2526a.%2526activitymap.%2526page%253DBOOK%25253AAIR%25253APlan%252520Trip%252520Page%2526link%253DSearch%2526region%253Dswa-content%2526pageIDType%253D1%2526.activitymap%2526.a%2526.c"
}
url = "https://www.southwest.com/api/air-booking/v1/air-booking/page/air/booking/shopping"
data = {
    "originationAirportCode": "LAS",
    "destinationAirportCode": "BOS",
    "departureDate": "2023-07-14",
    "departureTimeOfDay": "ALL_DAY",
    "returnTimeOfDay": "ALL_DAY",
    "adultPassengersCount": "1",
    "tripType": "oneway",
    "fareType": "USD",
    "passengerType": "ADULT",
    "adultsCount": "1",
    "int": "HOMEQBOMAIR",
    "reset": "true",
    "returnDate": "",
    "application": "air-booking",
    "site": "southwest"
}
data = json.dumps(data, separators=(',', ':'))

for i in range(10):
    response = requests.post(url, headers=headers, data=data, proxies={
        'http': 'http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600',
        'https': 'http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600',
    }, cookies=cookies, verify=False)

    print(response.text)
    print(response)