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 = '_pxvid=f26bf1ac-1d97-11ef-9ab5-5f69ec42bf03; _px2=eyJ1IjoiZjIxMmE0YjAtMWQ5Ny0xMWVmLWFiMGUtMjE0MzJkYTI1YzFiIiwidiI6ImYyNmJmMWFjLTFkOTctMTFlZi05YWI1LTVmNjllYzQyYmYwMyIsInQiOjE3MTY5NzI2OTM4NTEsImgiOiIwYzE3ZDlhYzYzYzg5OGM1MjljOWViYzZmYTU1MTczMTczZjM1OGNlMWNiZWZmOWQ5MDk5NWE4MzRkZDFlM2MxIn0='




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'


for i in range(20):
    # prox = 'http://127.0.0.1:8890'
    # url = "http://httpbin.org/ip"
    response = requests.post('http://52.52.23.116/tls/forward',
    # response = requests.post('http://127.0.0.1:58000/tls/forward',

                             json={
            'url': 'https://booking.flyfrontier.com/Flight/InternalSelect?o1=BNA&d1=ATL&dd1=Apr%2027,%202024&ADT=1&mon=true&promo=',
            'headers': {
                "Host": "booking.flyfrontier.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\"",
                "upgrade-insecure-requests": "1",
                "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",
                "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-fetch-site": "same-site",
                "sec-fetch-mode": "navigate",
                "sec-fetch-user": "?1",
                "sec-fetch-dest": "document",
                "accept-language": "en",
                "cookie": cks
            },
            'allow_redirects': True,
            'debug': True,
            'method': "GET",
            'proxy': prox,
            'random_tls': True,

        }

                             )

    print(response.json())

    print(response.json()['status_code'])
    print('FlightData' in response.json()['text'])
