-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuniRes.py
40 lines (31 loc) · 1.51 KB
/
uniRes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import time
import os
from datetime import datetime
timestamp = int(time.time())
dt_object = datetime.fromtimestamp(timestamp)
try:
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--no-sandbox")
driver = webdriver.Chrome(executable_path=os.environ.get("CHROMEDRIVER_PATH"), chrome_options=chrome_options)
#driver = webdriver.Chrome("D:\\Python\\Drivers\\chromedriver_win32\\chromedriver.exe")
driver.get("https://charusat.edu.in:912/Uniexamresult")
inst = Select(driver.find_element_by_xpath('/html/body/form/div[3]/table[2]/tbody/tr[1]/td[2]/select'))
inst.select_by_value('21')
degr = Select(driver.find_element_by_xpath("/html/body/form/div[3]/table[2]/tbody/tr[2]/td[2]/select"))
degr.select_by_value('132')
sem = Select(driver.find_element_by_xpath("/html/body/form/div[3]/table[2]/tbody/tr[3]/td[2]/select"))
sem.select_by_value('6')
exam = Select(driver.find_element_by_xpath("/html/body/form/div[3]/table[2]/tbody/tr[4]/td[2]/select"))
if len(exam.options)>3:
from pushbullet import Pushbullet
APIKEY = "o.7wUgnRpILz5jam1qmJE6bA4hpR3eLRxW"
pb = Pushbullet(APIKEY)
push = pb.push_note(f"Results Available!", "")
print(f"Last Update: {dt_object}")
except:
print(f"Last Failed: {dt_object}")