Skip to content

Commit 7be869d

Browse files
authored
Merge pull request #11 from FestplattenSchnitzel/tu_dresden
Fix session number extraction for TU Dresden Selma
2 parents 7243038 + 57a0212 commit 7be869d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/campusnet/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
import sys
23
from typing import Union, List
34
from dataclasses import dataclass
@@ -100,10 +101,9 @@ def _login(self):
100101
# url will be "/scripts/mgrqispi.dll?APPNAME=CampusNet&PRGNAME=STARTPAGE_DISPATCH&ARGUMENTS=-N954433323189667,-N000019,-N000000000000000"
101102
# and arguments will be "-N954433323189667,-N000019,-N000000000000000"
102103
# 954433323189667 is the session id, 000019 is the menu id and -N000000000000000 are temporary arguments
103-
url = "=".join(response.headers["Refresh"].split(";")[
104-
1].strip().split("=")[1:])
105-
arguments = url.split("ARGUMENTS=")[1]
106-
self.session_number = arguments.split(",")[0][2:]
104+
self.session_number = re.match(
105+
r"^.*-N(\d+),-N(\d+),-N(\d+)$", response.headers["Refresh"]
106+
).group(1)
107107

108108
def _get_semesters(self):
109109
"""

0 commit comments

Comments
 (0)