File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -19,5 +19,5 @@ def get_flights_from_google_sheet(self) -> dict:
1919 print (f"Error in request: { err } " )
2020
2121
22- test = DataManager (api_key = "" )
22+ # test = DataManager(api_key="")
2323print (test .get_flights_from_google_sheet ())
Original file line number Diff line number Diff line change 11import requests
22
3+
34class FlightSearch :
45 # This class is responsible for talking to the Flight Search API.
56 # https://tequila.kiwi.com/
67 # https://api.tequila.kiwi.com/v2/search?
78
8- def __init__ (self ):
9- pass
9+ def __init__ (self , api_key : str ):
10+ self .__API_URL = ""
11+ self .__HEADERS = {
12+ 'Authorization' : f'Basic { api_key } '
13+ }
14+
15+ def get_flight_price (self , info : dict ) -> dict :
16+ try :
17+ response = requests .get (self .__API_URL , headers = self .__HEADERS )
18+ response .raise_for_status ()
19+ data = response .json ()
20+ return data
21+ except requests .exceptions .HTTPError as err :
22+ print (f"Error in request: { err } " )
You can’t perform that action at this time.
0 commit comments