import requests
import tls_client

session = tls_client.Session(client_identifier='chrome_117')

headers = {
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.95 Safari/537.36",
    "pragma": "no-cache", "referer": "https://www.flyfrontier.com/", "cache-control": "no-cache",
    "content-type": "application/json", "origin": "https://www.flyfrontier.com",

    "authority": "www.flyfrontier.com", "accept": "application/json, text/plain, */*", "accept-language": "en-US"}
url = "https://booking.flyfrontier.com/Flight/InternalSelect?o1=BNA&d1=ATL&dd1=Apr%2027,%202024&ADT=1&mon=true&promo="
cks = 'ASP.NET_SessionId=ihwbo45eoowvupwzwxomxg5v; __RequestVerificationToken=x-ZSSdHlXMVJ7O2eTLJQ3jkjGRuJCdC_RcK8oePoDerhy_5wR0QVblMuCOehsQcNgJZRvL5Kd1UK5yHYFeEnBmDuS6ki3I_F30KL85Pv3-NywoV7P6zCqvb4629qy8OZ6CvRwg2; dotrez=!CnivcHTAVzJanI8uf6ZSo6dUbzw/bkjc3KPBdM872oqh2wI0uFelhMyMFgRbw2WRRoP+iId2sLEb8A==; dtCookie=v_4_srv_2_sn_FEF87482CA71806DAC2FC5A3FD55DEE0_perc_100000_ol_0_mul_1_app-3Aea7c4b59f27d43eb_0_rcs-3Acss_0; _pxhd=fc89f95c3c260e2013a32b1c547ee786d0ec75b96e75bad79566ea8a1807581b:ba338dac-44ed-11ef-8750-75c8eb11a49c; _px2=eyJ1IjoiYmE1NTg3NDAtNDRlZC0xMWVmLWI2ZGMtODU5ZDg2NzM3NmNlIiwidiI6ImJhZDU3MjY4LTQ0ZWQtMTFlZi1iMWRlLTE2NWUxOGQ4MTA5OSIsInQiOjYyMDIzMzg4MDAwNCwiaCI6IjZmZjgxMzYyZWUxODcxYThjYWZmYjFjMGNhZWUyZjY3YzE5YzE2YTgwMzVlOTcxOTJlYzdkNjU2ZGU2ODdlYzkifQ==; pxcts=bad57b7d-44ed-11ef-b1df-140968312052; _pxvid=bad57268-44ed-11ef-b1de-165e18d81099'












# cks += '; __RequestVerificationToken=TJeXz3uOWbbEVS6QfoI7oCycnodOj5yimDS32fQzhMDMsW2uvCV94tqzuCnt23HTuyhOei5BxWlYeBvzHwfKg1rU0IxUAMAuy-XJMLBHZ3hvxSR4uLFQ-BrGm7936V1kwwMQ8w2'
kccs = {
  'ASP.NET_SessionId': 'ihwbo45eoowvupwzwxomxg5v',
  '__RequestVerificationToken': 'x-ZSSdHlXMVJ7O2eTLJQ3jkjGRuJCdC_RcK8oePoDerhy_5wR0QVblMuCOehsQcNgJZRvL5Kd1UK5yHYFeEnBmDuS6ki3I_F30KL85Pv3-NywoV7P6zCqvb4629qy8OZ6CvRwg2',
  '_px2': 'eyJ1IjoiMTAxYzliYjAtNDRlMy0xMWVmLTlhMWMtYWRjMTY4ZDIzNmNlIiwidiI6IjEwODBlYjdhLTQ0ZTMtMTFlZi04ZDY4LTYzM2NmZTgxM2Y4NSIsInQiOjYyMDIzMzg4MDAwNCwiaCI6IjBiNmQ2MTQ1NTQwN2VhN2Y0ZGU2ZDQ0NWM4ZDI0NDliYmI3N2U0ODllMThiZDlkNWRjMzEzMmIwYTUzZTRhNGIifQ==',
  '_pxhd': '65ef9274d54623ed1de8de059730ea5576652e3fd9dfe9e0595f2f6f507f5e3e:1080eb7a-44e3-11ef-8d68-633cfe813f85',
  '_pxvid': '1080eb7a-44e3-11ef-8d68-633cfe813f85',
  'dotrez': '!CnivcHTAVzJanI8uf6ZSo6dUbzw/bkjc3KPBdM872oqh2wI0uFelhMyMFgRbw2WRRoP+iId2sLEb8A==',
  'dtCookie': 'v_4_srv_2_sn_FEF87482CA71806DAC2FC5A3FD55DEE0_perc_100000_ol_0_mul_1_app-3Aea7c4b59f27d43eb_0_rcs-3Acss_0',
  'pxcts': '1080f42c-44e3-11ef-8d68-efcca8bd572c'
}


cks = '; '.join([f'{k}={v}' for k, v in kccs.items()])

# prox = 'http://user-uni001-region-us-sessid-1114-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600'
# prox = f'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{random.randint(10000, 13500)}'
prox = 'http://user-uni001-region-us-sessid-4909-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600'
# prox = 'http://74.48.159.194:33080'
# prox = 'http://uni00002_custom_zone_US2_sid_4524195_time_5:FdkiGHty9a@us.ipwo.net:7878'
# print(prox)
# prox = 'http://uni00002_custom_zone_US2_sid_4428759_time_5:FdkiGHty9a@us.ipwo.net:7878'
# prox = 'http://brd-customer-hl_70986309-zone-isp-session-0.8665756910697877:ozfawewfxj8y@brd.superproxy.io:22225'
for i in range(20):
    # prox = 'http://127.0.0.1:7890'
    # url = "http://httpbin.org/ip"
    response = requests.post('http://52.52.23.116/tls/forward',
                             # response = requests.post('http://lcc.unififi.com/tls/forward',
    # response = session.post('http://127.0.0.1:59000/tls/forward',
                         # response = requests.post('http://192.168.50.197:58000/tls/forward',
                             json={
                                 'url': 'https://booking.flyfrontier.com/Flight/InternalSelect?o1=DEN&d1=LAS&dd1=2024-07-30&ADT=1&umnr=false&mon=true',
                                 'headers': {
                                     "accept-language": "en,en-US;q=0.9,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6",
                                     "pragma": "no-cache",
                                     "sec-fetch-user": "?1",
                                     "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
                                     "sec-ch-ua-platform": "\"MacIntel\"",
                                     "cache-control": "no-cache",
                                     "sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
                                     "sec-ch-ua-mobile": "?0",
                                     "sec-fetch-mode": "navigate",
                                     "priority": "u=0, i",
                                     "upgrade-insecure-requests": "1",
                                     "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
                                     "sec-fetch-dest": "document",
                                     "sec-fetch-site": "same-site",
                                     "cookie": cks,

                                 },
                                 'allow_redirects': True,
                                 'debug': True,
                                 'method': "GET",
                                 'proxy': prox,
                                 'random_tls': False,

                             }

                             )

    print(response.json()['cookies'])

    print(response.json()['status_code'])
    print('FlightData' in response.json()['text'])
    print(' has been denied', 'has been denied' in response.json()['text'])
    with open('1.html', 'w') as f:
        f.write(response.json()['text'])
    input('')
