Pijush2023 commited on
Commit
1105c96
·
verified ·
1 Parent(s): 7e66111

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -112
app.py CHANGED
@@ -1013,70 +1013,6 @@ def fetch_yelp_restaurants():
1013
 
1014
 
1015
 
1016
- # def fetch_google_hotels(query="Birmingham Hotel", check_in="2024-08-14", check_out="2024-08-15", adults=2):
1017
- # params = {
1018
- # "engine": "google_hotels",
1019
- # "q": query,
1020
- # "check_in_date": check_in,
1021
- # "check_out_date": check_out,
1022
- # "adults": str(adults),
1023
- # "currency": "USD",
1024
- # "gl": "us",
1025
- # "hl": "en",
1026
- # "api_key": os.getenv("SERP_API")
1027
- # }
1028
-
1029
- # search = GoogleSearch(params)
1030
- # results = search.get_dict()
1031
- # hotel_results = results.get("properties", [])
1032
-
1033
-
1034
-
1035
- # hotel_info = ""
1036
- # for hotel in hotel_results[:5]: # Limiting to top 5 hotels
1037
- # name = hotel.get('name', 'No name')
1038
- # description = hotel.get('description', 'No description')
1039
- # link = hotel.get('link', '#')
1040
- # check_in_time = hotel.get('check_in_time', 'N/A')
1041
- # check_out_time = hotel.get('check_out_time', 'N/A')
1042
- # rate_per_night = hotel.get('rate_per_night', {}).get('lowest', 'N/A')
1043
- # before_taxes_fees = hotel.get('rate_per_night', {}).get('before_taxes_fees', 'N/A')
1044
- # total_rate = hotel.get('total_rate', {}).get('lowest', 'N/A')
1045
- # deal = hotel.get('deal', 'N/A')
1046
- # deal_description = hotel.get('deal_description', 'N/A')
1047
- # nearby_places = hotel.get('nearby_places', [])
1048
- # amenities = hotel.get('amenities', [])
1049
-
1050
- # # Adding the "Location" field
1051
- # location = f"{name}, Birmingham, AL"
1052
-
1053
- # hotel_info += f"**Hotel Name:** [{name}]({link})\n"
1054
- # hotel_info += f"**Location:** {location}\n"
1055
- # hotel_info += f"**Description:** {description}\n"
1056
- # hotel_info += f"**Check-in Time:** {check_in_time}\n"
1057
- # hotel_info += f"**Check-out Time:** {check_out_time}\n"
1058
- # hotel_info += f"**Rate per Night:** {rate_per_night} (Before taxes/fees: {before_taxes_fees})\n"
1059
- # hotel_info += f"**Total Rate:** {total_rate}\n"
1060
- # hotel_info += f"**Deal:** {deal} ({deal_description})\n"
1061
-
1062
- # if nearby_places:
1063
- # hotel_info += "**Nearby Places:**\n"
1064
- # for place in nearby_places:
1065
- # place_name = place.get('name', 'Unknown Place')
1066
- # transportations = place.get('transportations', [])
1067
- # hotel_info += f" - {place_name}:\n"
1068
- # for transport in transportations:
1069
- # transport_type = transport.get('type', 'N/A')
1070
- # duration = transport.get('duration', 'N/A')
1071
- # hotel_info += f" - {transport_type}: {duration}\n"
1072
-
1073
- # if amenities:
1074
- # hotel_info += "**Amenities:**\n"
1075
- # hotel_info += ", ".join(amenities) + "\n"
1076
-
1077
- # hotel_info += "-" * 50 + "\n"
1078
-
1079
- # return hotel_info
1080
 
1081
 
1082
 
@@ -1143,54 +1079,6 @@ def fetch_google_hotels(query="Birmingham Hotel", check_in="2024-08-14", check_o
1143
 
1144
 
1145
 
1146
- # def fetch_google_flights(departure_id="JFK", arrival_id="BHM", outbound_date="2024-08-14", return_date="2024-08-20"):
1147
-
1148
-
1149
- # params = {
1150
- # "engine": "google_flights",
1151
- # "departure_id": departure_id,
1152
- # "arrival_id": arrival_id,
1153
- # "outbound_date": outbound_date,
1154
- # "return_date": return_date,
1155
- # "currency": "USD",
1156
- # "hl": "en",
1157
- # "api_key": os.getenv("SERP_API") # Replace with your actual API key
1158
- # }
1159
-
1160
- # search = GoogleSearch(params)
1161
- # results = search.get_dict()
1162
-
1163
- # # Extract flight details from the results
1164
- # best_flights = results.get('best_flights', [])
1165
- # formatted_flights = []
1166
-
1167
- # # Process each flight in the best_flights list
1168
- # for i, flight in enumerate(best_flights, start=1):
1169
- # flight_info = f"Flight {i}:\n"
1170
-
1171
- # for segment in flight.get('flights', []):
1172
- # departure_airport = segment.get('departure_airport', {}).get('name', 'Unknown Departure Airport')
1173
- # departure_time = segment.get('departure_airport', {}).get('time', 'Unknown Time')
1174
- # arrival_airport = segment.get('arrival_airport', {}).get('name', 'Unknown Arrival Airport')
1175
- # arrival_time = segment.get('arrival_airport', {}).get('time', 'Unknown Time')
1176
- # duration = segment.get('duration', 'Unknown Duration')
1177
- # airplane = segment.get('airplane', 'Unknown Airplane')
1178
-
1179
- # # Format the flight segment details
1180
- # flight_info += f" - Departure: {departure_airport} at {departure_time}\n"
1181
- # flight_info += f" - Arrival: {arrival_airport} at {arrival_time}\n"
1182
- # flight_info += f" - Duration: {duration} minutes\n"
1183
- # flight_info += f" - Airplane: {airplane}\n"
1184
-
1185
- # formatted_flights.append(flight_info)
1186
-
1187
- # # Combine the formatted flight information into a single output
1188
- # final_output = "Here are some available flights for today:\n\n" + "\n".join(formatted_flights)
1189
-
1190
-
1191
-
1192
-
1193
- # return final_output
1194
 
1195
  def format_flight_info(flight_number, departure_airport, departure_time, arrival_airport, arrival_time, duration, airplane):
1196
  return f"""
 
1013
 
1014
 
1015
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1016
 
1017
 
1018
 
 
1079
 
1080
 
1081
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1082
 
1083
  def format_flight_info(flight_number, departure_airport, departure_time, arrival_airport, arrival_time, duration, airplane):
1084
  return f"""