File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ import requests
2
+
3
+ SHEETY_PRICES_ENDPOINT = "https://api.sheety.co/********************************/flightDeals/prices/"
4
+ SHEETY_USERS_ENDPOINT = "https://api.sheety.co/*********************************/flightDeals/users"
5
+
6
+
7
+ class DataManager :
8
+
9
+ def __init__ (self ):
10
+ self .destination_data = {}
11
+
12
+ def get_destination_data (self ):
13
+ response = requests .get (url = SHEETY_PRICES_ENDPOINT )
14
+ data = response .json ()
15
+ self .destination_data = data ["prices" ]
16
+ return self .destination_data
17
+
18
+ def update_destination_codes (self ):
19
+ for city in self .destination_data :
20
+ new_data = {
21
+ "price" : {
22
+ "iataCode" : city ["iataCode" ]
23
+ }
24
+ }
25
+ response = requests .put (
26
+ url = f"{ SHEETY_PRICES_ENDPOINT } /{ city ['id' ]} " ,
27
+ json = new_data
28
+ )
29
+ print (response .text )
30
+
31
+ def get_customer_emails (self ):
32
+ customers_endpoint = SHEETY_USERS_ENDPOINT
33
+ response = requests .get (url = customers_endpoint )
34
+ data = response .json ()
35
+ self .customer_data = data ["users" ]
36
+ return self .customer_data
You can’t perform that action at this time.
0 commit comments