I am new to Python. I recently wrote a basic web scraping script that uses BeautifulSoup. The script is designed to search a specific for changes. If changes are found then the script alerts me via email.
I'm having a issue where the script fails when it reaches a certain point.
If you have an answer to the problem or have a better way of accomplish this task please let me know.
Here's part of my code:
import time
from bs4 import BeautifulSoup as soup
import requests
url = 'http://www.google.com'
page_response = requests.get(url, timeout=5)
#Everything seems to work up to here.
while True:
if str(soup).find("arenas") == -1:
time.sleep(60)
continue
else:
msg = 'Subject: Check'
fromaddr = 'Sending Email'
toaddrs = ['1','2','3']
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login("Sending Email", "Sending Password")
print('From: ' +fromaddr)
print('To: ' +str(toaddrs))
print('Message: ' +msg)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()