from requests import *
import datetime
import base64
payload = {
'action': 'login',
'username': "mollre",
'password': base64.b64decode(b"QW5uaWthMjU=").decode("utf-8"), #should be obfuscated
}
moodleLogin = "https://moodle2.dfg.fr.schule-bw.de/moodle/blocks/exa2fa/login/"
iteration=1
table=[]
aktuellerplan=""
with session() as c:
c.post(moodleLogin, data=payload)
while "
Fehler" not in aktuellerplan:
if len(str(iteration))==1:
tabelleurl = "https://moodle2.dfg.fr.schule-bw.de/moodle/pluginfile.php/7889/mod_resource/content/7/subst_00"+str(iteration)+".htm"
else:
tabelleurl = "https://moodle2.dfg.fr.schule-bw.de/moodle/pluginfile.php/7889/mod_resource/content/7/subst_0"+str(iteration)+".htm"
iteration+=1
aktuellerplan = c.get(tabelleurl).text
table.append(aktuellerplan)
print("Download: "+"=="*iteration,end="\r")
print("")
print("Download finished")
aktuellerplan=table[:-1]
#Download of every part of the plan (saved as list)
#The following basically is the concatenuation of the lsit into working html (small modifications)
for i in range(len(aktuellerplan)-1):
pos = aktuellerplan[i].index("")+8]+aktuellerplan[0][aktuellerplan[0].index("")+219:]
aktuellerplan[0]=aktuellerplan[0][:aktuellerplan[0].index("\"mon_head\"")+21]+""+aktuellerplan[0][aktuellerplan[0].index("Runzstr. 83")+17:]
aktuellerplan[0]=aktuellerplan[0][:aktuellerplan[0].index("tr.odd")+20]+" #ffffff"+aktuellerplan[0][aktuellerplan[0].index("tr.odd")+28:]
aktuellerplan[0]=aktuellerplan[0][:aktuellerplan[0].index("tr.even")+21]+" #e3e3e3"+aktuellerplan[0][aktuellerplan[0].index("tr.even")+29:]
#removal of UNTIS Text, saves space
aktuellerplan[-1]=aktuellerplan[-1][:-285]+"
Last upload:"+str(datetime.datetime.now().time())+"
"+"