Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2018
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. import requests
  2. import urllib3
  3. import selenium
  4. from selenium import webdriver
  5. import time
  6. from fbchat import Client
  7. from fbchat.models import *
  8. import difflib
  9.  
  10.  
  11.  
  12.  
  13. EMAIL = 'Bessi'
  14. PASSWORD = '753951Aa.'
  15.  
  16. URL = "https://platforma.polsl.pl/rau1/login/index.php"
  17. URLGRADES = "https://platforma.polsl.pl/rau1/grade/report/user/index.php?id=141"
  18.  
  19. def main():
  20.  
  21. counter = 0
  22.  
  23. driver = webdriver.Chrome(executable_path="C:/Users/mstan/Downloads/chromedriver_win32/chromedriver.exe")
  24. client = Client('bbessiak@gmail.com', 'niemamhasla99')
  25.  
  26. driver.get(URL)
  27. fillingUsername = driver.find_element_by_id("username")
  28. fillingUsername.click()
  29. fillingUsername.send_keys(EMAIL)
  30.  
  31. fillingPassword = driver.find_element_by_id("password")
  32. fillingPassword.click()
  33. fillingPassword.send_keys(PASSWORD)
  34.  
  35. loginButton = driver.find_element_by_id("loginbtn")
  36. loginButton.click()
  37. driver.get(URLGRADES)
  38.  
  39.  
  40. oldpagesource = driver.find_element_by_tag_name("body")
  41. original = oldpagesource.text
  42. newpagesource = driver.find_element_by_tag_name("body")
  43. new = newpagesource.text
  44.  
  45. while(original == new):
  46. time.sleep(60)
  47. driver.get(URLGRADES)
  48. newpagesource = driver.find_element_by_tag_name("body")
  49. new = newpagesource.text
  50. print(counter)
  51. print("times szerczed")
  52. counter = counter +1
  53.  
  54.  
  55. text1_lines = original.splitlines()
  56. text2_lines = new.splitlines()
  57.  
  58. d = difflib.Differ()
  59. diff = d.compare(text1_lines, text2_lines)
  60. print('\n'.join(diff))
  61. client.send(Message(text='Hi me!'), thread_id=client.uid, thread_type=ThreadType.USER)
  62. print("page was changed at time.... " + time.strftime('Time: %H:%M:%S'))
  63.  
  64.  
  65.  
  66.  
  67. # with open("C:/Users/mstan/Desktop/Grades.txt", "w",encoding='utf-8') as content_file:
  68. # content_file.write(r)
  69.  
  70.  
  71.  
  72. if __name__ == '__main__':
  73. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement