#
# 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 requests
import json


headers = {
    "Host": "ibe.api.flyscoot.com",
    "sec-ch-ua": "\"Google Chrome\";v=\"117\", \"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"117\"",
    "sec-ch-ua-mobile": "?0",
    "x-scoot-client-session": "78504ca8-7ebf-4878-88d7-aa79bad2a3de",
    "authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyZGFiOTViZS1lOGFjLTQ5YTgtODI4NS03NjQ2YTNhNzdlODMiLCJpYXQiOjE2OTc2ODE3NDAsInRrbiI6ImV5SmhiR2NpT2lKSVV6STFOaUlzSW5SNWNDSTZJa3BYVkNKOS5leUp6ZFdJaU9pSlZibXR1YjNkdUlpd2lhblJwSWpvaU5UUTBPRGhoTmpJdFpqUmhPQzB3TWpFeUxUUXdZVEV0Wm1SbU5XTmpZVFl6WlRVeklpd2lhWE56SWpvaVpHOTBVa1ZhSUVGUVNTSjkuaWNWeW8wZkxCOTJqbC1qVkVQSWlnSmlzY29ZWVFFZkJkTkM1ZlhfSEFhWSIsImlzcyI6InNjb290LWNtdyIsImF1ZCI6InNjb290LWFwcCJ9.vWi41pv28jUNkpdOf1NJ9G79crE42u89nf447MCErOc",
    "x-scoot-client-version": "0.0.0",
    "x-scoot-client-environment": "PROD",
    "content-type": "application/json",
    "accept": "application/json, text/plain, */*",
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
    "x-scoot-appsource": "IBE-WEB",
    "sec-ch-ua-platform": "\"macOS\"",
    "origin": "https://beta.makeabooking.flyscoot.com",
    "sec-fetch-site": "same-site",
    "sec-fetch-mode": "cors",
    "sec-fetch-dest": "empty",
    "accept-language": "en-US,en;q=0.9"
}
tk = {'token': '3:hLNPM/FJ42UJIREojwH4gw==:LRsi1ZVl7cStuayxLXtWSvU+ujviW3O3IUpPqTNhMisTTTxRzbi1Kjk27v26yHTxpooN13mJqkU3jbZ67fnkeiRF1oUzE1pNbHm6zy9FaXxDYXxyEmhmZ2UgVBsXinZQoeKPpwTKSoIsWeQ/7Z0FbTgER08hu2BxC6r0zElgC+5BH3Wz1eDNupsnrceP2iCzese1hSY5h/YDTUWYwhohtgO9J5M1puQn1JWQDWx30mIPewOFzaAsURv2i7mSfy9Fh7o6SWGq5e8sL0lnYsNfOPKXzsqpJ7P+qh6K7slKsO7iIvECramMEDJ/qAnnN5jR0AIwo9Tnlz9DYNTB+AntIq6ugIwLZZL0J/NLoosoAvgLLYSuhp0ITZnh1H/enecP5Bsrbv7I49TcNcJvY67ooepeBl5WfD8k3nghu2gq4oqO8byVPPpdA754BSguEqI8iMNI1Fx9HQxRz6HBDFUfgEI2mF2HtEnJ6GRJqNUtmKM8hXX9q++Z5CmQ6FvT4ovWFHgeTGHnY/9PwbDDc4NAZQ==:zATLGWtNQPJyHGxmebNbMYRJ0f/ybJoqbHY9bVeUCdM=', 'renewInSec': 897, 'cookieDomain': '.flyscoot.com'}

cookies = {
    "reese84": "3:vxybC7p3hsZePBuJoyhM0A==:EtQO6aXarh6Nc63yVYnUUBproiFXnn247vw9VN4e730/mWM6UNDAPeqKZE0BCkRG2dqv9u5/ZZ7xOT22FbDY2HUCtLRDEhXR4IRORs5Bx+rcaGwoPMPbtIdfBlyh8Lkogn7/cPYfZf6zDhAizxBccQWTlR2drfMLMPnWjfNQrnatFOsNR8mK1N05LK6ZzJdw6k/JETIA770y1byfXDLGa/ng51alDFJym9G9YyD+1+5ehOohB4sRNlW4iwc1Hs3ENW6kDMg7lKs9Lc6Zg+3P1Nft5t72qyiycqO+wyaZAUHQmio3A0JfCfWzbkAnWU8m+NV6yp/7rH6EQ4ei6pLLiHD202kFWbEI0C281HpvqKmiGujDhZXYuQT1VVgL0TjMh9HmDZCgcnwLHQ54vPmczCpzP6rzPvd68pbJC+Y+YvCxdFduzR+K8gQ4MMX6TK3T21XzrqjKAcGTwu0Q6qe0bBBKHzton31Cni+c92wz2gU=:xj38Xs2yXGljRuFj3XCspcu4Jyi3dpx/a4O3SqUeiVM=",
    # "reese84": tk['token'],
    "visid_incap_2572958": "PR2Ifx/iR5emGW58N9ofwEuRMGUAAAAAQUIPAAAAAABkoEo07vc5+gNY6Ny0wV5t",
    "nlbi_2572958": "iX9hMwRucHy+iVcE3Zs2agAAAAA36Uzl/T9S2MCD7nT6yrGi",
    "incap_ses_1512_2572958": "gmp7VJlDzCfD/oqAsLT7FEuRMGUAAAAA7Vx9L9TQAEitw4iH9BjoSw==",
    "_gcl_au": "1.1.1125811041.1697681744",
    "_ga": "GA1.1.1526378520.1697681744",
    "_ga_GFV545L5B3": "GS1.1.1697681743.1.0.1697681743.60.0.0",
    "_cls_v": "b70454a8-3d7e-47fd-b7ba-3205fd4f46fa",
    "_cls_s": "bdca8c45-b1a5-42fe-921a-caf564bd6954:0",
    "__clickidc": "169768174471845017",
    "_fbp": "fb.1.1697681744316.280343139",
    "dtCookie": "v_4_srv_-2D96_sn_GPMC8EALE5076L3GMNMRTKDTSGVHCCCJ",
    "rxVisitor": "1697681744538NJ06AD13G7MP1H2ITI42RSCVKSD7AUHS",
    "dtSa": "-",
    "rxvt": "1697683544543|1697681744538",
    "dtPC": "-96$281744536_923h-vMRDALFCWIFNGJAAQFVCKUKTHNCAHDCUP-0e0",
    "tfpsi": "305072e0-447a-4683-bf54-b29f70474466",
    "tmpcurr": "HKD",
    "AMP_TOKEN": "%24NOT_FOUND",
    "_yjsu_yjad": "1697681744.d764a69e-4b35-4d30-9927-3e1615ee576a",
    "_tt_enable_cookie": "1",
    "_ttp": "wbUq2MqpZU4RavnCMqmXR4pnUan",
    "QSI_HistorySession": "https%3A%2F%2Fbeta.makeabooking.flyscoot.com%2FBook%2FFlight%3Fculture%3Den-SG%26type%3Doneway%26dst1%3DHKG%26ast1%3DSIN%26dst2%3DSIN%26ast2%3DHKG%26dd%3D2023-10-28%26rd%3Dnull%26adt%3D1%26chd%3D0%26inf%3D0~1697681745165"
}
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=(',', ':'))
response = requests.post(url, headers=headers, cookies=cookies, data=data)

print(response.text)
print(response)