import json
import random

import requests


headers = {
    "authority": "jbrest.jetblue.com",
    "accept": "application/json",
    "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
    "api-version": "v3",
    "application-channel": "Desktop_Web",
    "booking-application-type": "NGB",
    "cache-control": "no-cache",
    "content-type": "application/json",
    "origin": "https://www.jetblue.com",
    "pragma": "no-cache",
    "referer": "https://www.jetblue.com/booking/flights?from=JFK&to=LAX&depart=2023-09-16&isMultiCity=false&noOfRoute=1&lang=en&adults=1&children=0&infants=0&sharedMarket=false&roundTripFaresFlag=false&usePoints=false",
    "sec-ch-ua": "\"Chromium\";v=\"116\", \"Not)A;Brand\";v=\"24\", \"Microsoft Edge\";v=\"116\"",
    "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/116.0.0.0 Safari/537.36 Edg/116.0.1938.69",
    "x-1itxwo9i-a": "l8jO8P7SWtl296jobeBGExSkNwIhDLQwSZBTZWEIsufA26CfgviWZq5kuXCc_Pi5_n-LkQa7IMMVQEVAovkCiTcATEiZtx6Hw3pBRbhIHohwLEcnEC3Ia8NRkwiS1r8L-Xsei_sHLnOzPAd0Ow8Be8nvTAX3TTGG98XeU4Atfx3Pd005N2tQvVSfeKY4kTJoWPibORxp4bqEEKQnyLfvBzI_f3AVLZ_vbBVzqdJ1A3uMeSK9yVxyAOyUWNC=6yJ2WyEMh0EYwaUpvZv4B3RDiIVv38UervDRnCK5U2noqPThMskNHzGT8NxWe2OHM0b=NLCms5=G_PN-tyClhZjyI-XZI2oQPWMzTSWpGSKGPIGQs6CXUGV-GzK0_OfV7UQvpYHy25=36NhUbfnN_sRhLM13O=bXa-r58qvfdzqH6Jv_7EX4x7sfjpb-eXO0QG23n-WkqBBO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QtbDMnTNInKqY7YZoAb4PKD2x6O_otn2ar1JVsdRDZ3QzM6AfPs6nEzTp0OuCcXY4UWh9QCGO3R=gehbkKGhJY9UZQTQHpnf7qcJ6WVquVhDz3GbUlsPXWx7-_CL2oHUhssLTbclti5QWKpecnuWAMRyv6u4ExNsn_hnLDk9sJx6fNsH3wkXXP7mVHmuO3uJn6TncVeqKZTfW8izJ-T1YROsGLX7H_PIQTVMhN-sAunt-n0NRl7=zg64n-7-PR9_fciu2wDJJkk0pP6r=02NIRUUSVBSPAy9TzqfUkVo=rW0ekyQIgOZYPHuAjSXvTJuAfwKxpjh-77viG7G5s1DY2jYS0T2uBQm46BPJj=RcoWnx=MjpZrMINEMd-bDJAHPbPbqjYBfMtgEwAq9tAkfUcI42mm_kQ_3X-V1h4lKCMTmC5uE8lDYMXnyg==j6VxquLUk_sCbGxwdXYMPkBgLJzmhkJ_ab9tZ8CGrtjUv9SUGoMx7P",
    "x-1itxwo9i-b": "-5jiyvt",
    "x-1itxwo9i-c": "AAD5tZeKAQAA5AGBfSVpzaCYgbSYMfPTk4AS9pvgoY2H_C9Iy5a7sFU8bE0L",
    "x-1itxwo9i-d": "ABaAhIjBCKHFgQGAAYIQgISi0aIA5JmBzvpDzz8AlruwVTxsTQsAAAAAH29cNgB31hxThZL125XOgPtXFfu6",
    "x-1itxwo9i-f": "A61guZeKAQAACKEYJYyYrIPbggOeb_BWxP7CMc8W4dpLa-SWjddIbvnwCIRYAXL3RNgXTuHJwH9eCOfvosJeCA==",
    "x-1itxwo9i-z": "q",
    "x-b3-spanid": "1694762625442",
    "x-b3-traceid": "5f707d06f26e7c7c"
}
uri = 'http://ymx-lcc.unififi.com/header/add'
proxy = f'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{int(random.randint(10000, 11149))}'
r = requests.post(uri, json={
    'brush_fromto': 'LAS-BOS',
    'brush_fromdate': '2023-05-26',
    'brush_header': headers,
    'brush_proxy': proxy,
    'brush_mode': 'shopping',
    'brush_name': 'js',
    'brush_type': 'headerB6',
})

print(r.text)

print(json.dumps({
    'brush_fromto': 'LAS-BOS',
    'brush_fromdate': '2023-05-26',
    'brush_header': headers,
    'brush_proxy': proxy,
    'brush_mode': 'shopping',
    'brush_name': 'js',
    'brush_type': 'headerB6',
}))