Skip to content

Instantly share code, notes, and snippets.

@hanjae-jea
Created September 5, 2018 13:35
Show Gist options
  • Save hanjae-jea/0fab381b56b6e9bde0c9488d602261d5 to your computer and use it in GitHub Desktop.
Save hanjae-jea/0fab381b56b6e9bde0c9488d602261d5 to your computer and use it in GitHub Desktop.
import smtplib
from email.mime.text import MIMEText
from time import sleep
from selenium import webdriver
smtp = smtplib.SMTP('smtp.gmail.com', 587)
smtp.ehlo()
smtp.starttls()
smtp.login('[email protected]', '')
PLmsg = MIMEText('프언떴다')
PLmsg['Subject'] = '프언떳다'
PLmsg['To'] = '[email protected]'
MLmsg = MIMEText('기계학습떳다')
MLmsg['Subject'] = '기계학습떳다'
MLmsg['To'] = '[email protected]'
DTmsg = MIMEText('데통떳다')
DTmsg['Subject'] = '데통떳다'
DTmsg['To'] = '[email protected]'
smtp.sendmail('[email protected]', '[email protected]', PLmsg.as_string())
driver = webdriver.Chrome('D:\\temp\\chromedriver')
driver.get('http://sugang.korea.ac.kr')
input()
isPL = True
isML = True
isDT = True
while True:
if isPL:
sleep(1)
driver.get('http://sugang.korea.ac.kr/lecture/LecLmtInfoUniv.jsp?year=2018&term=2R&courcd=COSE212&courcls=02')
mem = driver.find_element_by_css_selector('.total:nth-child(2)').text
if mem != '80':
smtp.sendmail('[email protected]','[email protected]', msg.as_string())
isPL = False
sleep(1)
driver.get('http://sugang.korea.ac.kr/lecture/LecLmtInfoUniv.jsp?year=2018&term=2R&courcd=COSE212&courcls=03')
mem = driver.find_element_by_css_selector('.total:nth-child(2)').text
if mem != '80':
smtp.sendmail('[email protected]', '[email protected]', msg.as_string())
isPL = False
if isML:
sleep(1)
driver.get('http://sugang.korea.ac.kr/lecture/LecLmtInfoUniv.jsp?year=2018&term=2R&courcd=COSE362&courcls=04')
mem = driver.find_element_by_css_selector('.total:nth-child(2)').text
if mem != '75':
smtp.sendmail('[email protected]', '[email protected]', MLmsg.as_string())
isML = False
if isDT:
sleep(1)
driver.get('http://sugang.korea.ac.kr/lecture/LecLmtInfoUniv.jsp?year=2018&term=2R&courcd=COSE242&courcls=02')
mem = driver.find_element_by_css_selector('.total:nth-child(2)').text
if mem != '100':
smtp.sendmail('[email protected]', '[email protected]', DTmsg.as_string())
ifDT = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment