import random

import requests
import tls_client

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

prox = f'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{random.randint(10000, 13500)}'
#     // prox = `http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:${randint(10000, 13500)}`
# prox = 'http://uni00001_custom_zone_US_sid_67336720_time_5:q39CEBTs5A@us.foxyip.com:7778'
prox = 'http://user-uni001-region-us-sessid-1111-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600'
# prox = 'http://uni00001_custom_zone_US_sid_67336723_time_5:q39CEBTs5A@us.foxyip.com:7778'


# prox = 'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:12019'
cks = '_gcl_au=1.1.1116693815.1703237112; pxcts=0212cc6e-a0ac-11ee-88f2-be53543893c0; _pxvid=0212c27e-a0ac-11ee-88f2-f15c063793b6; _uetsid=02478dc0a0ac11eeb166331d2cc0e235; _uetvid=0247b560a0ac11ee98050fa9b1146819; _gid=GA1.2.469486537.1703237113; _ga_XXXX=GS1.1.1703237112.1.0.1703237112.0.0.0; _ga=GA1.1.903446873.1703237113; wisepops=%7B%22csd%22%3A1%2C%22popups%22%3A%7B%7D%2C%22sub%22%3A0%2C%22ucrn%22%3A67%2C%22cid%22%3A%2278471%22%2C%22v%22%3A4%2C%22bandit%22%3A%7B%22recos%22%3A%7B%7D%7D%7D; wisepops_visits=%5B%222023-12-22T09%3A25%3A12.027Z%22%5D; wisepops_session=%7B%22arrivalOnSite%22%3A%222023-12-22T09%3A25%3A12.027Z%22%2C%22mtime%22%3A1703237113217%2C%22pageviews%22%3A1%2C%22popups%22%3A%7B%7D%2C%22bars%22%3A%7B%7D%2C%22sticky%22%3A%7B%7D%2C%22countdowns%22%3A%7B%7D%2C%22src%22%3Anull%2C%22utm%22%3A%7B%7D%2C%22testIp%22%3Anull%7D; _rdt_uuid=1703237113232.2606cfc5-96ad-44be-87e9-8f73e408af8f; _fbp=fb.1.1703237114642.1729860690; _pin_unauth=dWlkPU1qQTNaR1ZqWWpJdE1qWmxNUzAwTVdNd0xUazNNVEF0TXpRd1kyVTJOMkU1Tm1VMw; _tt_enable_cookie=1; _ttp=kB4eSSu9K3fSQ61a5q4PWvjEen8; _up=1.2.935388638.1703237118; _ga_P2WLKWBNNW=GS1.1.1703237112.1.0.1703237119.53.0.0; _px2=eyJ1IjoiMDFiNzY3YzAtYTBhYy0xMWVlLWJkYzYtZGJmMjBmZTg0MTZhIiwidiI6IjAyMTJjMjdlLWEwYWMtMTFlZS04OGYyLWYxNWMwNjM3OTNiNiIsInQiOjE3MDMyMzg3ODU3NTksImgiOiI3OTdhZDlhNTM2MTQzZDQ3MWZjMWEwMmY1Mjg5MzRhYTNlMjUxYmVlNTE0ZWVjZGU0YTg3M2E5YTVmZDViN2JlIn0='

# cks = '_pxvid=568dad46-943f-11ee-97cd-fc5e04cd8e29; pxcts=568dbb9e-943f-11ee-97cd-a3273e57225d; _px2=eyJ1IjoiNTRhNDJjODAtOTQzZi0xMWVlLWJjYjUtYTkwODI5MTk5MTNiIiwidiI6IjU2OGRhZDQ2LTk0M2YtMTFlZS05N2NkLWZjNWUwNGNkOGUyOSIsInQiOjE3MDE4NzEzMjg3MjEsImgiOiIxYzNlNmVhNmI5NDQ4ZjE1YjA2MDA1OGU5MDJhN2UyMTJmMzk2Yzc5YmMwMWM0NmUxYWJlZDVmNzU2ZWI4NjQ4In0='






url = 'https://booking.flyfrontier.com/Flight/InternalSelect?o1=DEN&d1=LAS&dd1=2023-12-30&ADT=1&umnr=false&mon=true'
response = requests.post('http://52.52.23.116/tls/forward',
                         json=dict(url=url, headers={
                             "authority": "booking.flyfrontier.com",
                             "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",
                             "accept-language": "en-US,en;q=0.9",
                             "cache-control": "no-cache",
                             "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": "document",
                             "sec-fetch-mode": "navigate",
                             "sec-fetch-site": "none",
                             "sec-fetch-user": "?1",
                             "upgrade-insecure-requests": "1",
                             "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",
                             "cookie": cks
                         }, method="GET", proxy=prox, debug=True
                                   , allow_redirects=True
                                   ))
response = response.json()
print(response)
print(response['status_code'])
print(response['text'])
with open('index.html', 'w') as f:
    f.write(response['text'])
