syncMyMoodle 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: syncMyMoodle
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Synchronization client for RWTH Moodle
5
5
  Home-page: https://github.com/Romern/syncMyMoodle
6
6
  Author: Nils Kattenbeck
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = syncMyMoodle
3
- version = 0.2.2
3
+ version = 0.2.3
4
4
  author = Nils Kattenbeck
5
5
  author_email = nilskemail+pypi@gmail.com
6
6
  description = Synchronization client for RWTH Moodle
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: syncMyMoodle
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Synchronization client for RWTH Moodle
5
5
  Home-page: https://github.com/Romern/syncMyMoodle
6
6
  Author: Nils Kattenbeck
@@ -226,10 +226,26 @@ class SyncMyMoodle:
226
226
  with cookie_file.open("wb") as f:
227
227
  pickle.dump(self.session.cookies, f)
228
228
  return
229
- soup = bs(resp.text, features="html.parser")
230
- if "Wartungsarbeiten" in resp.text:
231
- logger.critical(soup.find("body").text)
229
+
230
+ # Create a separate soup for maintenance detection
231
+ soup_check = bs(resp.text, features="html.parser")
232
+
233
+ # Remove known info banners
234
+ for banner in soup_check.select(".themeboostunioninfobanner"):
235
+ banner.decompose()
236
+
237
+ # Extract body text after cleanup
238
+ body_text = soup_check.find("body").get_text(separator=" ", strip=True)
239
+
240
+ # Check for maintenance notice
241
+ if "Wartungsarbeiten" in body_text:
242
+ logger.critical(
243
+ "Detected Maintenance mode! If this is an error, please report it on GitHub."
244
+ )
245
+ logger.info("Cleaned page body:\n%s", body_text)
232
246
  sys.exit()
247
+
248
+ soup = bs(resp.text, features="html.parser")
233
249
  if soup.find("input", {"name": "RelayState"}) is None:
234
250
  csrf_token = soup.find("input", {"name": "csrf_token"})["value"]
235
251
  login_data = {
File without changes
File without changes