From 27938c64767a4d0a3f32406707d33eeac5c23fd7 Mon Sep 17 00:00:00 2001 From: fastily Date: Mon, 27 Nov 2023 03:29:20 -0800 Subject: [PATCH] raise on login failures --- pwiki/wiki.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pwiki/wiki.py b/pwiki/wiki.py index 4fcc993..1239858 100644 --- a/pwiki/wiki.py +++ b/pwiki/wiki.py @@ -51,8 +51,8 @@ def __init__(self, domain: str = "en.wikipedia.org", username: str = None, passw self._refresh_rights() - if not self._load_cookies(username): - self.login(username, password) + if username and not (self._load_cookies(username) or self.login(username, password)): + raise RuntimeError(f"Failed to login for '{username}'!") self.ns_manager: NSManager = OQuery.fetch_namespaces(self)