Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Amazon Wishlist Notifier/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
WISHLIST_URL = 'https://www.amazon.com/gp/registry/wishlist/YOUR_WISHLIST_ID'
CHECK_INTERVAL = 3600 # Check every hour


def get_wishlist_items():
headers = {
"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"
Expand All @@ -28,14 +29,16 @@ def get_wishlist_items():
price_element = item.find('span', class_='a-offscreen')
price = price_element.get_text().strip() if price_element else "Price not available"
availability = "In stock" if "In Stock" in item.get_text() else "Out of stock"
wishlist.append({'name': name, 'price': price, 'availability': availability})
wishlist.append({'name': name, 'price': price,
'availability': availability})

return wishlist

else:
print("Failed to retrieve wishlist data from Amazon.")
return []


def send_email(subject, message):
msg = MIMEText(message)
msg['Subject'] = subject
Expand All @@ -48,6 +51,7 @@ def send_email(subject, message):
server.sendmail(SENDER_EMAIL, RECIPIENT_EMAIL, msg.as_string())
server.quit()


def main():
while True:
wishlist_items = get_wishlist_items()
Expand All @@ -66,5 +70,6 @@ def main():

time.sleep(CHECK_INTERVAL)


if __name__ == "__main__":
main()