Advertisement
ACGT

Untitled

May 26th, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import os
  3. import string
  4. from time import sleep
  5. import requests
  6.  
  7. def send_email(SUBJECT):
  8.             import smtplib
  9.             mail_user = "188888888@wo.cn"
  10.             mail_pwd = "88888"
  11.             FROM = '188888888@wo.cn'
  12.             TO = ['188888888@wo.cn'] #must be a list
  13.             TEXT = SUBJECT
  14.  
  15.             # Prepare actual message
  16.             message = """\From: %s\nTo: %s\nSubject: %s\n\n%s
  17.            """ % (FROM, ", ".join(TO), SUBJECT, TEXT)
  18.             try:
  19.                 #server = smtplib.SMTP(SERVER)
  20.                 server = smtplib.SMTP("smtp.wo.cn", 25)
  21.                 #server.ehlo()
  22.                 #server.starttls()
  23.                 server.login(mail_user, mail_pwd)
  24.                 server.sendmail(FROM, TO, message)
  25.                 #server.quit()
  26.                 server.close()
  27.                 print 'successfully sent the mail'
  28.             except Exception, e:
  29.                 print str(e)
  30.  
  31.  
  32. while 1:
  33.     try:
  34.         url="http://www.douyutv.com/erke"
  35.         r = requests.get(url,timeout=10,verify=False)
  36.         if "feedback_report_button" in r.text:
  37.                 send_email("erke")
  38.                 sleep(11000)
  39.         sleep(100)
  40.     except Exception, e:
  41.         print str(e)
  42.         sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement