You are viewing a single comment's thread from:
RE: Payment for Coding done
Main monitoring loop
while True:
current_price = get_flight_price()
if current_price < threshold_price:
message = message_template.format('Destination', current_price)
# Send an email notification
try:
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(gmail_username, gmail_password)
server.sendmail(sender_email, recipient_email, f'Subject: {subject}\n\n{message}')
server.quit()
print(f'Email notification sent for price: ${current_price}')
except Exception as e:
print(f'Error sending email notification: {str(e)}')
# Sleep for a specified interval (e.g., check every 1 hour)
time.sleep(3600)