import json

import tls_client

sess = tls_client.Session(client_identifier='chrome_120', random_tls_extension_order=True)

sess.proxies = {
    'http': 'http://127.0.0.1:8890',
    'https': 'http://127.0.0.1:8890',
}
headers = {
    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkb3RSZXpXZWIiLCJqdGkiOiI5NjQ4NGVmNC01ZDRhLWNmZGQtMmUxNS0yODZmOTI0NDJiYjgiLCJpc3MiOiJkb3RSRVogQVBJIn0.kj6XQ3UeeQdfCRWlXerCm8e0K6tom2rBh94KPoq8ZaQ',
    'cookie': '_px2=eyJ1IjoiOTQ2ZGRmMTAtZjg5OC0xMWVlLWFiMGUtMjE0MzJkYTI1YzFiIiwidiI6Ijk0YjIyMWNlLWY4OTgtMTFlZS1hM2EzLTc1NTRjYTE4ODBiNiIsInQiOjYyMDIzMzg4MDAwNCwiaCI6IjdmYTJmZDNmN2EyNDgxOTIxNjNjZTRjM2Y3Zjg4ZWExYzg0Njc4ZmY1YWIwZGVlNGZmMDZiNTllYTVkZTQ3YWQifQ==; pxcts=94b237f6-f898-11ee-a3a4-c5a68439d54c; _pxvid=94b221ce-f898-11ee-a3a3-7554ca1880b6; _abck=C0058C0262CE56DE9E46BB4254E069A0~0~YAAQMDovF09sgMKOAQAAuwcQ0Qvnv9opEByhFscRc9yNfRSPXrJLLan1MorhU2fjcDX7FO6+kD6Yz4a29xVYdBG/OkGegWjJft7Ia0tWKoNpPkmS26fzu37iMYogZHfaxxumEfPXXouGtDti9JMdyxwRbbhyVBCF2ZFagwC7lvc7bpQ4jbFO9+CQxIX+ofoHz8+6v1h9cvt/d/b8LO4vndxqAE+t4xXN37s1ZmYwIQ1oFu6ozjlXvbR3gaUG+XlnWUEAdxBIMLAlsIFlwxsNpUbvGGB1esMlKxW6cHO78NPKotVPQsPuOLO3i4w5KK+0nEoyJkW81qvZ9DCU+dswmCX9GPO1102Tmr8vQWKyDecn1gqbRk+zWGgnTHbcWejlDw6w2POQKIMj2rAtWEDOmkNUDPHeefb6nA==~-1~-1~1712908072; _pxhd=d146b6d169419729440a5220a86870206d20a665ef018c2c7f0d94903574a539:951c3ccd-f898-11ee-b651-697d5e746336; ak_bmsc=266B825ABC5951EF63A9FE8D599169F7~000000000000000000000000000000~YAAQMDovFxNsgMKOAQAAlgQQ0RfDSLV6FdCv8qx4pOh2nauiHQUuDFSVODso/bai2uhip7lcR3BxXhitdtxE0364ydSCMmECTKdYMC+zLa1ISHT6Af3pd/yagWEIWJfAqYmr8NmYOWY/cjEA5h/Mau6lSJe+durUscIKcciDGc6k5v+T/7eTAOQ6JNt6fowOTesGYWMGp8uilgA4pxr7zAllg/pTZTkffBACVZlyBfYFfr1KhlWUD2Kqxv12f6H1lWEoqTHv62VH1LmLoBdaEo2Hpu/Ny5Na/KDcBEMyV6/UXucHakVfMCEpWVcr8xQvg09qGzuovreP0hpwhy1uIXQpCpCqMKsbiDltm44eJsTGmO27mWuN0OxER0Fm5imJOXqREg00EN7O; bm_sz=910004B959D07353D28A50942BA43467~YAAQMDovF1BsgMKOAQAAuwcQ0ReeyKQoa4R0eX2SyJhGJsTy8PLGTf2s+PCmThAjRMB3KkMfGmKP8ImpP70Rv06L87ZtlD1uSI9Xnngk0VZiqwjt3QcuQrXa5l8MurpP9IncsGDrMfuzvmZURXq1nDJCQ3P5zCpt4EEv/roNsLous2IEsLwPm1ayOcKMukXjsPYLMQVMpd82hX4juXwJNsWPbvfkaD4hUQW06QO8RBcqbEqDhyrFE2/H5OsUytJz1FsJ8XYoGJBqzObNvoQgRBm8n2Fgxm1VXeWIt+xiQoSTRxO5fG+ZHPs9pWai6SS6zBgE0K3CklFSputY2FPsGZJB0N4bEoV5p5CBW9cB1agdP3qUFvPlbkVvFrUf044Jk1DibbRVdvXEZ/oEZ+86PQ==~3355448~3487801; userCountryLocation=US; userGeolocation=-92.5003, 34.5942',
    "authority": "www.spirit.com",
    "accept": "application/json, text/plain, */*",
    "accept-language": "en-US",
    "cache-control": "no-cache",
    "content-type": "application/json",
    "ocp-apim-subscription-key": "dc6844776fe84b1c8b68affe7deb7916",
    "origin": "https://www.spirit.com",
    "pragma": "no-cache",
    "referer": "https://www.spirit.com/",
    "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
    "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/120.0.0.0 Safari/537.36",
    "x-dtpc": "10$492787436_542h10vNDAFLLHTQHFKVMUIMICENMIBAMBWCDES-0e0"

}

url = "https://www.spirit.com/api/prod-availability/api/availability/search"
data = {"includeWifiAvailability": True, "criteria": [{"stations": {"originStationCodes": ["DFW"],
                                                                    "destinationStationCodes": ["FLL"],
                                                                    "searchDestinationMacs": False,
                                                                    "searchOriginMacs": False},
                                                       "dates": {"beginDate": "2024-04-24", "endDate": "2024-04-24"},
                                                       "filters": {"filter": "Default"}}],
        "passengers": {"types": [{"type": "ADT", "count": 1}]}, "codes": {"currency": "USD"},
        "fareFilters": {"loyalty": "MonetaryOnly", "types": [], "classControl": 1}, "taxesAndFees": "TaxesAndFees",
        "originalJourneyKeys": [], "originalBookingRecordLocator": None, "infantCount": 0, "birthDates": []}
data = json.dumps(data, separators=(',', ':'))
response = sess.post(url, headers=headers, data=data)

print(response.text)
print(response)
