-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnote.py
31 lines (24 loc) · 805 Bytes
/
note.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
from bs4 import BeautifulSoup
from tabulate import tabulate
import requests
base_url = "https://sinu.utcluj.ro/Note_up/default.asp"
UTILIZATOR = "UTILIZATOR" # Username here
PAROLA = "PAROLA" # Password here
payload = {
'hidSelfSubmit':'default.asp',
'hidOperation': 'N',
'hidUtilizator': UTILIZATOR,
'hidParola': PAROLA,
'txtNume': UTILIZATOR,
'txtParola':PAROLA
}
r = requests.post(base_url, data=payload)
soup = BeautifulSoup(r.content, "lxml")
table = soup.find('table', attrs={'class':'table'})
rows = table.find_all('tr')
data = []
for row in rows:
cols = row.find_all('td')
cols = [ele.text.strip() for ele in cols]
data.append([ele for ele in cols if ele])
print(tabulate(data, tablefmt="grid"))