Advertisement
Guest User

Untitled

a guest
Feb 17th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. import smtplib
  2. import time
  3.  
  4. try:
  5.     # For Python 3.0 and later
  6.     from urllib.request import urlopen
  7. except ImportError:
  8.     # Fall back to Python 2's urllib2
  9.     from urllib2 import urlopen
  10.  
  11. sub = True
  12. url = 'https://www.twitch.tv/products/' + streamer_name
  13.  
  14. while(sub):
  15.   try:
  16.     response = urlopen(url)
  17.     sub = False
  18.     break
  19.   except:
  20.     time.sleep(30)
  21.  
  22. gmail_user = 'user'  
  23. gmail_password = 'pass'
  24.  
  25. froms = gmail_user  
  26. to = ['ilovefreespam4real@gmail.com']  
  27. body = 'HAS A SUB BUTTON \n' + url
  28.  
  29.  
  30. try:  
  31.     server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
  32.     server.ehlo()
  33.     server.login(gmail_user, gmail_password)
  34.     server.sendmail(froms, to, body)
  35.     server.close()
  36.  
  37.     print( 'Email sent!')
  38. except:  
  39.     print ('Something went wrong...')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement