Nov-08-2021, 01:51 PM
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')