1212WISHLIST_URL = 'https://www.amazon.com/gp/registry/wishlist/YOUR_WISHLIST_ID'
1313CHECK_INTERVAL = 3600 # Check every hour
1414
15+
1516def get_wishlist_items ():
1617 headers = {
1718 "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():
2829 price_element = item .find ('span' , class_ = 'a-offscreen' )
2930 price = price_element .get_text ().strip () if price_element else "Price not available"
3031 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 })
3234
3335 return wishlist
3436
3537 else :
3638 print ("Failed to retrieve wishlist data from Amazon." )
3739 return []
3840
41+
3942def send_email (subject , message ):
4043 msg = MIMEText (message )
4144 msg ['Subject' ] = subject
@@ -48,6 +51,7 @@ def send_email(subject, message):
4851 server .sendmail (SENDER_EMAIL , RECIPIENT_EMAIL , msg .as_string ())
4952 server .quit ()
5053
54+
5155def main ():
5256 while True :
5357 wishlist_items = get_wishlist_items ()
@@ -66,5 +70,6 @@ def main():
6670
6771 time .sleep (CHECK_INTERVAL )
6872
73+
6974if __name__ == "__main__" :
7075 main ()
0 commit comments