Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,6 +28,8 @@ headers = {'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Acc
|
|
| 28 |
'User-Agent': 'Googlebot', 'X-Amzn-Trace-Id': 'Root=1-67615322-49c2abfb075610f458a05a02'}}
|
| 29 |
headers = headers["headers"]
|
| 30 |
|
|
|
|
|
|
|
| 31 |
for item in clean_cookie.split("; "):
|
| 32 |
if "=" in item:
|
| 33 |
key, value = item.split("=", 1)
|
|
@@ -60,10 +62,12 @@ async def get_flights(
|
|
| 60 |
):
|
| 61 |
# global cookie_dict
|
| 62 |
global headers
|
|
|
|
| 63 |
# print(cookie_dict)
|
| 64 |
|
| 65 |
url = f"https://www.tiket.com/ms-gateway/tix-flight-search/v3/search?origin={origin}&originType=AIRPORT&destination={destination}&destinationType=AIRPORT&adult={adult}&child={child}&infant={infant}&cabinClass={cabinClass}&departureDate={departureDate}&flexiFare=true&resultType={resultType}&searchType={searchType}&returnDate={returnDate}&enableVI=true"
|
| 66 |
-
|
|
|
|
| 67 |
# headers = {
|
| 68 |
# "Accept": "*/*",
|
| 69 |
# "Content-Type": "application/json",
|
|
|
|
| 28 |
'User-Agent': 'Googlebot', 'X-Amzn-Trace-Id': 'Root=1-67615322-49c2abfb075610f458a05a02'}}
|
| 29 |
headers = headers["headers"]
|
| 30 |
|
| 31 |
+
scraper = cloudscraper.create_scraper()
|
| 32 |
+
|
| 33 |
for item in clean_cookie.split("; "):
|
| 34 |
if "=" in item:
|
| 35 |
key, value = item.split("=", 1)
|
|
|
|
| 62 |
):
|
| 63 |
# global cookie_dict
|
| 64 |
global headers
|
| 65 |
+
global scraper
|
| 66 |
# print(cookie_dict)
|
| 67 |
|
| 68 |
url = f"https://www.tiket.com/ms-gateway/tix-flight-search/v3/search?origin={origin}&originType=AIRPORT&destination={destination}&destinationType=AIRPORT&adult={adult}&child={child}&infant={infant}&cabinClass={cabinClass}&departureDate={departureDate}&flexiFare=true&resultType={resultType}&searchType={searchType}&returnDate={returnDate}&enableVI=true"
|
| 69 |
+
# url = f"https://www.tiket.com/ms-gateway/tix-flight-search/v3/search?origin=CGK&originType=AIRPORT&destination=DPS&destinationType=AIRPORT&adult=1&child=0&infant=0&cabinClass=ECONOMY&departureDate=2024-12-20&flexiFare=true&resultType=DEPARTURE&searchType=ROUND_TRIP&returnDate=2024-12-21&enableVI=true"
|
| 70 |
+
|
| 71 |
# headers = {
|
| 72 |
# "Accept": "*/*",
|
| 73 |
# "Content-Type": "application/json",
|