import requests
import tls_client

session = tls_client.Session(client_identifier='chrome_117')
session.proxies = {
    'http': 'http://127.0.0.1:7890',
    'https': 'http://127.0.0.1:7890',
}

prox = 'http://user-uni001-region-us-sessid-1111-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600'
prox = 'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:9000'
# prox = 'http://127.0.0.1:7890'
session.proxies = {
    'http': prox,
    'https': prox,
}
# session.proxies = {
#     'http': "http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:11400",
#     'https': "http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:11400",
# }
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,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6",
    "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": "same-origin",
    "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"
}

headers['cookie'] = '__RequestVerificationToken=cCZfQbtoyI_K1mXPzAATHLn_FNTO-Q-7zBL3g6PpW2XkBG1a0Eth04mG3dJiA8HfEChZw0YdbTSGrZsdLpJw6LRgLcZdYotBHEnvCUd6u-DJlN3XX-Etzl-x14q4qC9Qb1BpmA2; _pxhd=d5403a7f64d0f2b0a602d1a003aeb795b4b8407958585d7c4b20a36b356e843e%3A399bce47-8213-11ee-a16a-1f9ffa30df36; pxcts=3c0c464d-8213-11ee-ae38-ccc7fa5f0b3e; _pxvid=399bce47-8213-11ee-a16a-1f9ffa30df36; _px2=eyJ1IjoiM2IzYzZmNzAtODIxMy0xMWVlLTk5NjktZGJlOThmNjdlNGJiIiwidiI6IjM5OWJjZTQ3LTgyMTMtMTFlZS1hMTZhLTFmOWZmYTMwZGYzNiIsInQiOjYyMDIzMzg4MDAwNCwiaCI6IjUzY2U5ZmQ5NzZkYzI3OTM2MmNkOGY0OWI2NmFkMzY5ZWI3MTdiMmQ0Zjc0Y2FjOGJhYmM0ZmUxNWExY2I3YmEifQ%3D%3D'






# cks = {'_px2': 'eyJ1IjoiOTY0ODdjMzAtNzk4OC0xMWVlLTgxYTktMjUyZjY0MDdjMTYxIiwidiI6Ijk3NmYxYzBlLTc5ODgtMTFlZS1iODYwLTAyNTVmY2JmZTU2MCIsInQiOjYyMDIzMzg4MDAwNCwiaCI6ImViY2U4ZmQ2ZjA3ZGIxNTkxY2YzMmI0MTg3OTcwZWI5NGY5ZDZkN2I2YjY4NGUxZjJiMjE2MGZlZjQxYWI0MzQifQ==', '_pxvid': '976f1c0e-7988-11ee-b860-0255fcbfe560', 'pxcts': '976f338c-7988-11ee-b860-865043e6e7b4'}


# cks = {}
# cookies.update(
# # {'_pxhd': '728b2d129b5a075513034298f8e2d4ce004425c1f307bd2baa8e9525fa6bb510:4290832e-77db-11ee-bdfb-76e73743688f', '_pxvid': '4290832e-77db-11ee-bdfb-76e73743688f', '_px2': 'eyJ1IjoiYjllMjlkNjEtNzA0MC0xMDMxLTk3ZjUtMjVlOTU0YzUxNGU5IiwidiI6IjQyOTA4MzJlLTc3ZGItMTFlZS1iZGZiLTc2ZTczNzQzNjg4ZiIsInQiOjE2OTg3NDk3MTE3OTksImgiOiIwZmZiOTUwNjRhODJiNzg4Yjg5YzQ1NDMzZThhMWQ5ZjQwNTY3NzcxNjU5MGY5Mjc0ZGNmYWIxY2MwN2RhMzZhIn0=', 'pxcts': '43453788-77db-11ee-a37b-78e6fe245189'}
#
# )

url = "https://booking.flyfrontier.com/Flight/InternalSelect?o1=DEN&d1=LAS&dd1=2023-11-30&ADT=1&umnr=false&mon=true"

# , cookies=cks
response = requests.post('http://52.52.23.116/tls/forward', json=dict(url=url,headers=headers, method="GET", proxy=prox, debug=True
#                                                                       # ,allow_redirects=True
                                                                      ))

# response = session.get(url, headers=headers, params=params
#                        # , cookies=
#                        # {
#                        #     '_pxhd': 'e33ffa239c65b81580fac5ff09060127bd0d0473a764327efb3b6fe47e696b6b:7750d29f-81d0-11ee-bcac-2b37f29a1872',
#                        #     'pxcts': '78fa88a4-81d0-11ee-9190-18bd99a3852f',
#                        #     '_pxvid': '7750d29f-81d0-11ee-bcac-2b37f29a1872',
#                        #     '_px2': 'eyJ1IjoiNzc3OGYzMjAtODFkMC0xMWVlLTkyMGItOGZjZTQ5ZmUwMzRhIiwidiI6Ijc3NTBkMjlmLTgxZDAtMTFlZS1iY2FjLTJiMzdmMjlhMTg3MiIsInQiOjYyMDIzMzg4MDAwNCwiaCI6IjkwMWYwZDNiMzU0ZjA0ZDMwZjQxNTVmODgxNjcyMjBjOWNjZDY0MTg4YzNiNDhmZDZiZWU1OWJkMjBkODM1MzYifQ=='}
#
#                        , allow_redirects=False)

print(response.text)
print(response.url)
print(response.json()['status_code'])
print(response.json()['text'])
