#
# import json
#
# import requests
# import tls_client
# session = tls_client.Session(client_identifier='chrome_112')
# px = 'http://127.0.0.1:7890'
# session.proxies = {
#     'http': px,
#     'https': px,
# }
#
# headers, cks = ({'Host': 'apigw.volaris.com', '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/115.0.0.0 Safari/537.36', 'Content-Type': 'application/json', 'Authorization': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJBUEkiLCJqdGkiOiJjOGU4YzQyYS1kZTE4LWQ1ZjgtYzcwZS0yYTk3NTE0NWUxM2IiLCJpc3MiOiJkb3RSRVogQVBJIn0.R85O4rA0tLfMAcrHu8MlZWfFmjMYS5eaWfOBF-kB3Yk', 'cookies': 'Bearer eyJraWQiOiJCaE10N01OTFVBNXdLbE5PRmFNU0liOUIwYUYxWWV0Z0VkaVJmWkJVYzJnPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI1cTB0NDRzazlrNjB2M3M5ZHZnZjZnbGZqOCIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoicnNcL3dyaXRlIHJzXC9yZWFkIiwiYXV0aF90aW1lIjoxNjkyNjk5MTc2LCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAudXMtd2VzdC0yLmFtYXpvbmF3cy5jb21cL3VzLXdlc3QtMl9GamFneTNwT0IiLCJleHAiOjE2OTI3MDI3NzYsImlhdCI6MTY5MjY5OTE3NiwidmVyc2lvbiI6MiwianRpIjoiZDc4MWI1Y2QtNjk3OS00N2ZkLTgyMmQtODE4NjE5Y2E1YzI4IiwiY2xpZW50X2lkIjoiNXEwdDQ0c2s5azYwdjNzOWR2Z2Y2Z2xmajgifQ.jXOnbJeSlb_8Nd4a0PZb19lYd0kfQ70FPM5Aeo5Tyg_zmhysxweQG9mvVz15QNy-QZjHCUjzzrx6XZzm8wf13ygS1pp-ApP03cPlsaaTeBV7Kb8WvbqQqm0ibZPQ1uGddv_VEqTDR3AHQEzyrQQFv2AXINl1TXBqtGLPVFcx03VN8B3yUSaQe-2oi7-sNiAe7EVcT4bT56XSogA2s_vsZbTBwZ529P3VtfmJNHu5JhSclzHvm7B_AZXwp6541WdxerURm5m-mNx09WUtS8BxWzJfewWVRm77eHs9NqMywHL9u8gpGYRjcSlf6Cu2RHsPVQiwOJsdqBWMPZj3lA30ng', 'Accept': 'application/json', 'sec-ch-ua-platform': '"macOS"', 'Origin': 'https://www.volaris.com', 'Referer': 'https://www.volaris.com/', 'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6'}, {'visid_incap_2041990': 'CwqOa7sPQDW09M0vj11rgyOK5GQAAAAAQUIPAAAAAACZNuTl6TgOfjQB+cpaul8e', 'nlbi_2041990': 'xU1VXrtlhzok5Dy61UqjOAAAAADOWWXmoaFMvql6IS09jMAB', 'incap_ses_1563_2041990': 'FH+nT/CZRExtQwz0b+SwFSWK5GQAAAAAZzzt6Q9NEsO7Yiye0YVCtA==', 'nlbi_2041990_2147483392': 'm0OnYc4ijAGgMKPp1UqjOAAAAAAtupPdNcbbvlu+pLRF9dl9', 'nlbi_2306356': 'wKT+cnwPz2oun+KtXEW6EwAAAADuQWtKXZQSk5bxMCE86Vkv', 'visid_incap_2306356': '+DDVWdI3S3OdG1ITygdgjSmK5GQAAAAAQUIPAAAAAAC2MSTxXl3eg+4rs6BogUu7', 'incap_ses_1563_2306356': 'svTlfMEtSyPbWAz0b+SwFSmK5GQAAAAAHENLmwuNnUpY4RvrE0kaiw==', 'reese84': '3:m5/7WcMyayLIegGCcoV8Hw==:x5P3sx63zLh4tOYZhW6Ly8SPuMV0TsOfG4wELJML64TzEaFcPScFU4WDAH3YX9ahB3n0DNxPa1FfacwiIxe2PPAmLW73GHvzVzGKo15joCSv1u0GxXThdXDAGxWYlGcx+5zRFcqHSG2T6+wcBJpykdVMKo/+Dh4VgH0jqv9HQnE5gbSVcO6YN5WWG7wFt0QRTDziBnaPpTibYF6QUYTduMWZ/BBhfMydNeoDz2MRD7zg2+D3VdKpppeTYRDGL8Y6aHpNqZTBMNMICS3TY7fZkJjeRRardOoc6qVKclFDe0d24bO6+kf6QG+stod7cdOCdVzFlE9U2O2oRNsbwhwqUuB+kcofmatdARbdv2EZNWaUEYy6M7rSPniUhdM8rK5/u5wt4AIQJbGrvfhhbBavGXbMhxFGaX/sMs4PgoccB9ZDRVtSgx9kAiLsHQywky/BfpqDDlF5fgLlfbf58ytrhk5pfq1zwdtvqx+M0Vkz9v0YykyKwHMQ8tk4gH1sOrkvffPKAXyzmnLho/nIM9h7+RtLTUeAdDx9NwZCs20Zgo6dMscPEC1KrWvJLv+iA9xUzFgGxpgEvinZjEWZZCVaIg==:2hWNySCnGJOPEJ67ZuJxP82VQw5agMu6RPhKR+h2TOM='})
#
# url = "https://apigw.volaris.com/prod/api/availability/search"
# data = {
#     "passengers": {
#         "types": [
#             {
#                 "type": "APL",
#                 "count": 1
#             }
#         ]
#     },
#     "criteria": [
#         {
#             "stations": {
#                 "originStationCodes": [
#                     "ACA"
#                 ],
#                 "destinationStationCodes": [
#                     "BOG"
#                 ]
#             },
#             "dates": {
#                 "beginDate": "Fri, Aug 11, 2023"
#             },
#             "filters": {
#                 "fareTypes": [
#                     "R"
#                 ],
#                 "maxConnections": 20
#             }
#         }
#     ],
#     "codes": {
#         "currencyCode": "MXN",
#         "promotionCode": "VUEH50"
#     },
#     "taxesAndFees": 2
# }
# data = json.dumps(data, separators=(',', ':'))
# response = session.post(url, headers=headers, data=data, cookies=cks)
#
# print(response.text)
# print(response)


import json

import requests

headers, cookies = ({'authority': 'ibe.api.flyscoot.com', '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', 'authorization': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0MDVlMTFjOC05M2EyLTQ2NTEtOGM5YS01NDhjY2RlMTZiZWMiLCJpYXQiOjE2OTg2NDQyMjUsInRrbiI6ImV5SmhiR2NpT2lKSVV6STFOaUlzSW5SNWNDSTZJa3BYVkNKOS5leUp6ZFdJaU9pSlZibXR1YjNkdUlpd2lhblJwSWpvaU5XVmlPREExWW1RdE9ESXdNaTAxWm1Fd0xXTXlNbUl0WTJSbVl6QmlOVGc1T1RZNElpd2lhWE56SWpvaVpHOTBVa1ZhSUVGUVNTSjkuT2x2MHlxa2JQZnNYV2NtLWlIdEVKdXdUbkdxNkpCUklmOHAwdGNEZmxwbyIsImlzcyI6InNjb290LWNtdyIsImF1ZCI6InNjb290LWFwcCJ9.3JX3G93xNncvBA9o426SuPHlW31w09iCtSaICaBaflc', 'cache-control': 'no-cache', 'content-type': 'application/json', 'origin': 'https://beta.makeabooking.flyscoot.com', 'pragma': 'no-cache', 'sec-ch-ua': '"Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"macOS"', '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/115.0.0.0 Safari/537.36', 'x-scoot-appsource': 'IBE-WEB', 'x-scoot-client-environment': 'PROD', 'x-scoot-client-session': '4ddf4d27-d6a1-4b50-b533-04558f7ab4b8', 'x-scoot-client-version': '0.0.0'}, {'nlbi_2739054_2147483392': 'C5XLRMPKilxR1ofynO/GLwAAAACTzirFG/ImFtoNa7kVu+iw', 'reese84': '3:2Bg/+yEnwP1HXteLBXqUuw==:TZnkbBgsbyRK2cbbEwigAC3yivuGRYIIi1nCZNsUuthxj86tkkrAZMjmWjA3BKdb6czQXTjP1OgDb0/kH023azcQlCZ/qIlweaOIW7jm0yQpmSb/r+eRVBvL49bfdLo3fUEDH+RQ79bzmSIRWjVvKP2GFrgalRISZh2+CxNe4e8pb5N6ra7JA/gzUWVQJfXcICVEWaemvAUNqpTXGiW0PoZfj0ljHWgx/SOeAPN9oUlqxRIIYDbSdup3r0ECK4tT+v2Z+MF9A6FFLCCH7tOMBJo2GObLqDn+cVH09HxEgsgNJfQlc4wIXB6Goprg+e2iv3SOxDliVjxLJm4bJY5KN1y6pYFJqAx0G1XQP5RM53odSfIKK5UeKPWehF0YHrHUKQ3vXtvU0GqCb9cHaKuLB4ou1g4FLpI4vUQZ9ha6vTpDJJ6/KZuf3Ujr1omC7BaqLo5DWjej0POEsvqWR36kNk9gYwqjSISFkAi9Ij5/bnA=:n2tcXYylaNGJYecEiHO/Xecc1ZzbeRrGCynQJpfz4Yg=', 'visid_incap_2572958': 'C0oLOEFhR1aNVjIGxWkaoABBP2UAAAAAQUIPAAAAAACRp/ej5a7m55PXUi/vLCDi', 'nlbi_2572958': '9euQD2bGvkOi1u0T3Zs2agAAAACiwKLY6LEjvapWn71ifpMm', 'incap_ses_200_2572958': 'AgxJHbnS3BLvp5ZTrYvGAgBBP2UAAAAAtnUAOM9JbnWAUnKHsrx2tA=='})

headers ={"sec-fetch-dest": "empty", "x-scoot-client-version": "0.0.0", "content-type": "application/json", "origin": "https://beta.makeabooking.flyscoot.com", "sec-ch-ua-platform": "\"macOS\"", "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/115.0.0.0 Safari/537.36", "cache-control": "no-cache", "sec-ch-ua-mobile": "?0", "x-scoot-client-session": "4ddf4d27-d6a1-4b50-b533-04558f7ab4b8", "cookie": "reese84=3:+O4TJuLHHjAq2MfhS3qSvw==:qJEJe0AEl2uC0bdlWcgvvSnOdVZfNNSoSSOFth/cED4gEEJYsJYFTlm7xBtLqqEKFiPWRWGUo0LgFWu9CqsdlknrW7r/7Al+vnTpsAFVRAIEIL7DZe3Eo7uD/+ipHdx2B0V8bHHAXTpW5RCuz1kA+QBC/u/jpXCFjIV1DZHEcubrJwdYTncHyoTX71YEvgbEFPNScvkM9JyJjg0Fob8lbItRjgAwYLngxcyanjijBJ7kHAXFIbBBXpH9CnTAQE947bELdUVZqlSirNqTePhCtFLZYWxNXoVAndne1cczTLwJlrPcLdkZmhyiKWC/8Ov0fhT7UpZeBhnZdYzftVdC6bK/M4nYvG5wpDamGlZ/m18SyoG9T9jhVa69Q329XTZqJ/gSOj1juXFvJowIfypag/2z9LIPyN+aS7cr2d0Ktm4KbY30RrHqsA1tfwGd3AY4GUQV3Omdzor3JTwzhI0cSsSwk20J3B3ExQMiYAispxY=:BABUv3/A9aUurRZ+GgtXFeUldIqILlSA0H7bskD9qf0=; incap_ses_186_2572958=YDuUVo7doDmbztUHFM6UAmFBP2UAAAAAL9eyePDcSMhJFPnWjPisIA==; nlbi_2572958=3NQEFM1eqyExIy/13Zs2agAAAAAB1vUwaQMi1j6zWCGXuQLK; visid_incap_2572958=KnbN6s4uSHibBEYK3LJjD2BBP2UAAAAAQUIPAAAAAADRJxaxw0gu29pkJZem4Xq2; nlbi_2739054_2147483392=o92KOhGgAT4wNt5MnO/GLwAAAACB4z3EpYmak6x5i7AwVVW/; incap_sh_2739054=ikE/ZQAAAAA0UEhsBgAQioP9qQb/pN4m019EHhwXLjKKHZhm; incap_wrt_777=mUI/ZQAAAABj92dWGgAIiQYQtsnP5r0BGPCJ/akGIAIoj4P9qQYwAUXaOuEkXIQGwJZfIe5Fx/A=", "accept": "application/json, text/plain, */*", "sec-ch-ua": "\"Google Chrome\";v=\"117\", \"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"117\"", "authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxYTA2N2QwNC01MjQ4LTQxN2MtYTJjYy03MmZlOTI0ZGE4NGIiLCJpYXQiOjE2OTg2NDQ2MzYsInRrbiI6ImV5SmhiR2NpT2lKSVV6STFOaUlzSW5SNWNDSTZJa3BYVkNKOS5leUp6ZFdJaU9pSlZibXR1YjNkdUlpd2lhblJwSWpvaU16VmxaVEJoWm1JdE1UZzJOUzFqTm1WbUxUUXlNR1l0TkdGak5qa3dNbUU0WTJGbElpd2lhWE56SWpvaVpHOTBVa1ZhSUVGUVNTSjkuc29wSTNKYjFOOHVnd2R0cTI3UEc5T1RqdVFSc3hiWjhLNmZxV0Z3WEJYOCIsImlzcyI6InNjb290LWNtdyIsImF1ZCI6InNjb290LWFwcCJ9.Yx_-WfwQpqd8qlnUTTRQBq9WOP4LmufYv_ViCCtBXNI", "pragma": "no-cache", "sec-fetch-mode": "cors", "x-scoot-appsource": "IBE-WEB", "x-scoot-client-environment": "PROD", "authority": "ibe.api.flyscoot.com", "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6"}

url = "https://ibe.api.flyscoot.com/v1/booking/flight/availability"
data = {
    "flightCriteria": [
        {
            "origin": "HKG",
            "destination": "SIN",
            "departureDate": "2023-10-28"
        }
    ],
    "passengerCriteria": {
        "adult": 1,
        "child": 0,
        "infant": 0
    },
    "currencyCode": "HKD",
    "promoCode": None,
    "salesCode": None,
    "flightFare": {
        "fareType": [],
        "classOfService": []
    },
    "cultureCode": "en-SG"
}
data = json.dumps(data, separators=(',', ':'))
# ,cookies=cookies
response = requests.post(url, headers=headers, data=data, proxies={
    'http': 'http://127.0.0.1:7890',
    'https': 'http://127.0.0.1:7890',
})

print(response.text)
print(response)
