Skip to content

Commit

Permalink
Fix session number extraction for TU Dresden Selma
Browse files Browse the repository at this point in the history
The "Refresh" header has a different format there:
"0; URL=/APP/STARTPAGE_DISPATCH/-N954433323189667,-N000150,-N000000000000000"
  • Loading branch information
FestplattenSchnitzel committed Feb 19, 2024
1 parent 7243038 commit 57a0212
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 57a0212

Please sign in to comment.