I’m following this price tracker video, and at a certain point, in order to allow the script to send a notification to my email, I need to change Gmail’s Less Secure App Access permissions—which apparently are being discontinued from Jan 2025 onwards. I tried running it anyways with a few tweaks, but I keep running into the following problem:
Error sending email: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)
Here’s the relevant section of my code for reference:
def send_email(price): port = 465 #Not sure if correct port smtp_server = "smtp.gmail.com" receiver_email = "random@gmail.com" password = getpass.getpass(prompt="Type your email password and press enter: ") message = f""" Subject: Price Alert: Iliad The Odyssey The price of the book has dropped to {price} CAD, which is below your target price of {wanted} CAD! You can buy it now at this price: https://www.indigo.ca/en-ca/iliad-the-odyssey/9781398803633.html """ context = ssl.create_default_context() try: # Basically trying to connect to Gmail's SMTP server and sending an email with smtplib.SMTP_SSL(smtp_server, port, context=context) as server: server.login(reciever_email, password) server.sendmail(receiver_email_email, receiver_email, message) print(f"Email sent! Price: {price}") except Exception as error: print(f"Error sending email: {error}")
Thanks for any insight into any fixes or alternatives!
submitted by /u/lite_runner
[link] [comments]
r/learnpython I’m following this price tracker video, and at a certain point, in order to allow the script to send a notification to my email, I need to change Gmail’s Less Secure App Access permissions—which apparently are being discontinued from Jan 2025 onwards. I tried running it anyways with a few tweaks, but I keep running into the following problem: Error sending email: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006) Here’s the relevant section of my code for reference: def send_email(price): port = 465 #Not sure if correct port smtp_server = “smtp.gmail.com” receiver_email = “random@gmail.com” password = getpass.getpass(prompt=”Type your email password and press enter: “) message = f””” Subject: Price Alert: Iliad The Odyssey The price of the book has dropped to {price} CAD, which is below your target price of {wanted} CAD! You can buy it now at this price: https://www.indigo.ca/en-ca/iliad-the-odyssey/9781398803633.html “”” context = ssl.create_default_context() try: # Basically trying to connect to Gmail’s SMTP server and sending an email with smtplib.SMTP_SSL(smtp_server, port, context=context) as server: server.login(reciever_email, password) server.sendmail(receiver_email_email, receiver_email, message) print(f”Email sent! Price: {price}”) except Exception as error: print(f”Error sending email: {error}”) Thanks for any insight into any fixes or alternatives! submitted by /u/lite_runner [link] [comments]
I’m following this price tracker video, and at a certain point, in order to allow the script to send a notification to my email, I need to change Gmail’s Less Secure App Access permissions—which apparently are being discontinued from Jan 2025 onwards. I tried running it anyways with a few tweaks, but I keep running into the following problem:
Error sending email: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)
Here’s the relevant section of my code for reference:
def send_email(price): port = 465 #Not sure if correct port smtp_server = "smtp.gmail.com" receiver_email = "random@gmail.com" password = getpass.getpass(prompt="Type your email password and press enter: ") message = f""" Subject: Price Alert: Iliad The Odyssey The price of the book has dropped to {price} CAD, which is below your target price of {wanted} CAD! You can buy it now at this price: https://www.indigo.ca/en-ca/iliad-the-odyssey/9781398803633.html """ context = ssl.create_default_context() try: # Basically trying to connect to Gmail's SMTP server and sending an email with smtplib.SMTP_SSL(smtp_server, port, context=context) as server: server.login(reciever_email, password) server.sendmail(receiver_email_email, receiver_email, message) print(f"Email sent! Price: {price}") except Exception as error: print(f"Error sending email: {error}")
Thanks for any insight into any fixes or alternatives!
submitted by /u/lite_runner
[link] [comments]