Любой джун напишет за 1 час, и не возьмет больше 500р
from bs4 import BeautifulSoup
import requests
import time
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
r = requests.get('http://expert.lenobl.ru/ru/deiatelnost/vydacha-razreshenij-na-stroitelstvo-i-na-vvod-obektov-v-ekspluataciyu', headers = headers)
def check():
soup = BeautifulSoup(r.text, 'html.parser')
mydivs = soup.findAll("div", {"class": "edit-redactor"})
return mydivs[0].text[9:].strip(' ')
def smtp():
msg = MIMEMultipart()
password = "ПАРОЛЬ"
login = 'логин@mail.ru'
msg['From'] = login
msg['To'] = login
msg['Subject'] = "Дата"
msg.attach(MIMEText('Дата изменилась', 'plain'))
server = smtplib.SMTP('smtp.mail.ru', 587)
server.starttls()
server.login(msg['From'], password)
server.sendmail(msg['From'], msg['To'], msg.as_string())
server.quit()
date = check()
while True:
time.sleep(2)
if date != check():
smtp()
print('Дата изменилась')
break
print('Проверка')