Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. import time
  2. from twill.commands import *
  3. from slacker import Slacker
  4.  
  5.  
  6. URL = 'https://certmetrics.com/juniper'
  7. username = 'XXXXXXXXXX'
  8. password = 'XXXXXXXXXX'
  9.  
  10. def login():
  11. print 'filling forms'
  12. fv('1', 'ctl00$mainContent$txtLoginCandidateLoginID', username)
  13. fv('1', 'ctl00$mainContent$txtLoginCandidatePass', password)
  14. print 'correcting form'
  15. formaction('1', 'https://www.certmetrics.com/juniper/login.aspx?ReturnUrl=%2fjuniper?')
  16. print 'submitting...'
  17. submit()
  18.  
  19. def checkforcert():
  20. while True:
  21. print 'checking exam page'
  22. go('https://www.certmetrics.com/juniper/candidate/requirements.aspx')
  23. result = show()
  24. if 'JNCIE-DC' in result:
  25. print 'JNCIE-DC result found!'
  26. post_slack()
  27. break
  28. else:
  29. print 'nothing found; sleeping 120 seconds...'
  30. time.sleep(120)
  31.  
  32. def post_slack():
  33. slack = Slacker('xoxp-136198617350-135519103730-161152603600-f712236f6d7791c8c1588d192b48510a')
  34. response = slack.users.list()
  35. slack.chat.post_message('#general', '@mtucker502: certmetrics has JNCIE-DC on the exam page!!!!')
  36.  
  37. def main():
  38. print 'Opening main page...'
  39. go('https://certmetrics.com/juniper')
  40.  
  41. #TODO check to see if login is needed
  42. login()
  43. checkforcert()
  44.  
  45. if __name__ == '__main__':
  46. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement