Skip to content

Commit

Permalink
Merge pull request #11 from FestplattenSchnitzel/tu_dresden
Browse files Browse the repository at this point in the history
Fix session number extraction for TU Dresden Selma
  • Loading branch information
frereit authored Feb 19, 2024
2 parents 7243038 + 57a0212 commit 7be869d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/campusnet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import sys
from typing import Union, List
from dataclasses import dataclass
Expand Down Expand Up @@ -100,10 +101,9 @@ def _login(self):
# url will be "/scripts/mgrqispi.dll?APPNAME=CampusNet&PRGNAME=STARTPAGE_DISPATCH&ARGUMENTS=-N954433323189667,-N000019,-N000000000000000"
# and arguments will be "-N954433323189667,-N000019,-N000000000000000"
# 954433323189667 is the session id, 000019 is the menu id and -N000000000000000 are temporary arguments
url = "=".join(response.headers["Refresh"].split(";")[
1].strip().split("=")[1:])
arguments = url.split("ARGUMENTS=")[1]
self.session_number = arguments.split(",")[0][2:]
self.session_number = re.match(
r"^.*-N(\d+),-N(\d+),-N(\d+)$", response.headers["Refresh"]
).group(1)

def _get_semesters(self):
"""
Expand Down

0 comments on commit 7be869d

Please sign in to comment.