12
12
WISHLIST_URL = 'https://www.amazon.com/gp/registry/wishlist/YOUR_WISHLIST_ID'
13
13
CHECK_INTERVAL = 3600 # Check every hour
14
14
15
+
15
16
def get_wishlist_items ():
16
17
headers = {
17
18
"User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
@@ -28,14 +29,16 @@ def get_wishlist_items():
28
29
price_element = item .find ('span' , class_ = 'a-offscreen' )
29
30
price = price_element .get_text ().strip () if price_element else "Price not available"
30
31
availability = "In stock" if "In Stock" in item .get_text () else "Out of stock"
31
- wishlist .append ({'name' : name , 'price' : price , 'availability' : availability })
32
+ wishlist .append ({'name' : name , 'price' : price ,
33
+ 'availability' : availability })
32
34
33
35
return wishlist
34
36
35
37
else :
36
38
print ("Failed to retrieve wishlist data from Amazon." )
37
39
return []
38
40
41
+
39
42
def send_email (subject , message ):
40
43
msg = MIMEText (message )
41
44
msg ['Subject' ] = subject
@@ -48,6 +51,7 @@ def send_email(subject, message):
48
51
server .sendmail (SENDER_EMAIL , RECIPIENT_EMAIL , msg .as_string ())
49
52
server .quit ()
50
53
54
+
51
55
def main ():
52
56
while True :
53
57
wishlist_items = get_wishlist_items ()
@@ -66,5 +70,6 @@ def main():
66
70
67
71
time .sleep (CHECK_INTERVAL )
68
72
73
+
69
74
if __name__ == "__main__" :
70
75
main ()
0 commit comments