We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9332afc commit e120be8Copy full SHA for e120be8
day39/data_manager.py
@@ -0,0 +1,28 @@
1
+import requests
2
+
3
+SHEETY_PRICES_ENDPOINT = "https://api.sheety.co/*************************/flightDeals/prices/"
4
5
6
+class DataManager:
7
8
+ def __init__(self):
9
+ self.destination_data = {}
10
11
+ def get_destination_data(self):
12
+ response = requests.get(url=SHEETY_PRICES_ENDPOINT)
13
+ data = response.json()
14
+ self.destination_data = data["prices"]
15
+ return self.destination_data
16
17
+ def update_destination_codes(self):
18
+ for city in self.destination_data:
19
+ new_data = {
20
+ "price": {
21
+ "iataCode": city["iataCode"]
22
+ }
23
24
+ response = requests.put(
25
+ url=f"{SHEETY_PRICES_ENDPOINT}/{city['id']}",
26
+ json=new_data
27
+ )
28
+ print(response.text)
0 commit comments