How to make scraper send email notification just once - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to make scraper send email notification just once (/thread-35481.html) |
How to make scraper send email notification just once - themech25 - Nov-08-2021 Hi, I've created a simple python scraper with beautifulsoup that checks a site every 5 minutes to see if it contains the word 'dog'. If the word is present, the script will send an email to the recipient. The problem is that, the script keeps sending the email every 5 minutes as long as the word dog is on the site. How do I make the script send the email just once instead of constantly every 5 mins. Thanks. import requests from bs4 import BeautifulSoup url = "https://justpaste.it/4f4jb" r = requests.get(url) soup = BeautifulSoup(r.content, 'html.parser') if 'dog' in soup.text: print('Email Sent') else: print('Nothing found') |