Nested Noten

This commit is contained in:
2024-01-11 14:50:28 +01:00
parent b8c2bea4ae
commit 3b8cf7e53d
9 changed files with 113 additions and 14 deletions

View File

@ -119,9 +119,9 @@ def getResults(token, cookie: str, resl: str):
vorlist = []
for row in vorl:
cols = row.find_all("td")
col = [e.text.strip() for e in cols]
col = [[e.text.strip()] for e in cols]
if len(col) != 0:
if len(col[4]) == 0:
if len(col[4][0]) == 0:
col[2] = getPruefung(row.find("a")["href"])
vorlist += [col[1:4]]
return vorlist
@ -132,20 +132,24 @@ def getPruefung(url):
Ermittelt Noten "geschachtelter" Prüfungen, die nicht auf der Hauptseite angezeigt werden.
TODO: Namen der spezifischen Prüfungen auch zurückgeben, um Zusammensetzung zu spezifizieren.
:param url:
:return:
:return list:
"""
response = requests.request("GET", "https://dualis.dhbw.de" + url, headers=headers, data={})
html = BeautifulSoup(response.content.decode("utf-8"), 'lxml')
table = html.find('table')
pruefung = table.find_all("tr")
ret = " "
ret = []
for row in pruefung:
cols = row.find_all("td")
col = [e.text.strip() for e in cols]
if len(col) == 6:
ret = col[3][:3]
if ret[1] != ",":
ret = "noch nicht gesetzt"
if len(col) == 6 and len(col[3]) <= 13:
if len(col[3]) != 0:
print (col)
ret += [col[0] + ": " + col[3][:3]]
if ret[-1][0] == ':':
ret[-1] = "Gesamt" + ret[-1]
if len(ret) == 0:
ret = ["Noch nicht gesetzt"]
return ret