Skip to content

Commit a2144d8

Browse files
committed
Login and Semesteriteration
0 parents  commit a2144d8

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

campusnet.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Julian Lemmerich
2+
# 30.06.2022
3+
# Interacting with Campus net
4+
# more specifically DHBW's Campusnet at dualis.dhbw.de
5+
6+
import requests
7+
import re
8+
9+
## Login
10+
11+
email = 's212689%40student.dhbw-mannheim.de' #urlencoded! @ = %40
12+
password = input('Password: ')
13+
14+
headers = {
15+
'Host': 'dualis.dhbw.de',
16+
'Content-Type': 'application/x-www-form-urlencoded',
17+
}
18+
19+
data = f'usrname={email}&pass={password}&APPNAME=CampusNet&PRGNAME=LOGINCHECK&ARGUMENTS=clino%2Cusrname%2Cpass%2Cmenuno%2Cmenu_type%2Cbrowser%2Cplatform'
20+
21+
response = requests.post('https://dualis.dhbw.de/scripts/mgrqispi.dll', headers=headers, data=data)
22+
23+
cnsc = response.headers['Set-cookie'][0:38].replace(" ", "") #cookie in format "csnc =FA27B61020C03AA5A83046B13D6CC38D; HttpOnly; secure" broken down to "csnc=FA27B61020C03AA5A83046B13D6CC38D"
24+
25+
# TODO: something is borken with that cnsc. It looks identical to a valid one, but only gives access denied.
26+
# debug:
27+
cnsc = 'cnsc=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
28+
29+
## Get all Semesters
30+
31+
# Prüfungsergebnisse Tab: https://dualis.dhbw.de/scripts/mgrqispi.dll?APPNAME=CampusNet&PRGNAME=COURSERESULTS&ARGUMENTS=-N422875220398735,-N000307,
32+
# Semesterlist: <select id="semester" .*> </select>
33+
# then get value from option, display name
34+
35+
headers = {
36+
'Host': 'dualis.dhbw.de',
37+
'Cookie': cnsc,
38+
}
39+
40+
response = requests.get('https://dualis.dhbw.de/scripts/mgrqispi.dll?APPNAME=CampusNet&PRGNAME=COURSERESULTS&ARGUMENTS=-N591469968597102,-N000307', data="", headers=headers)
41+
42+
print(response.text)
43+
44+
semester = {}
45+
46+
for match in re.findall('<option value=".*</option>', response.text):
47+
semester[match.split('>')[1].split('<')[0]]=match[15:30] #key=name, value=id
48+
49+
## Get all Prüfungen in Semester
50+
51+
## Get Prüfungen Results

0 commit comments

Comments
 (0)