Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import threading
- import urllib2
- import smtplib
- def send_email():
- gmail_user = "oteugmail@gmail.com" #edit
- gmail_pwd = "tuapass" #edit
- FROM = 'oteugmail@gmail.com' #edit
- TO = ['oteugmail@gmail.com'] #edit
- SUBJECT = "Bilhetes Final da Taรงa"
- TEXT = "Vai comprar imediatamente !!!"
- message = """\From: %s\nTo: %s\nSubject: %s\n\n%s
- """ % (FROM, ", ".join(TO), SUBJECT, TEXT)
- try:
- server = smtplib.SMTP("smtp.gmail.com", 587)
- server.ehlo()
- server.starttls()
- server.login(gmail_user, gmail_pwd)
- server.sendmail(FROM, TO, message)
- server.close()
- print 'successfully sent the mail'
- except:
- print "failed to send mail"
- def checkit():
- threading.Timer(300.0, checkit).start() #5 min
- req = urllib2.Request('https://bilheteira.fpf.pt')
- response = urllib2.urlopen(req)
- html = response.read()
- if(html.lower().find('taรงa de portugal') != -1 or html.lower().find('benfica') != -1):
- send_email()
- checkit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement