Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions scripts/push_to_wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,18 @@ def login(self, username, password):
"format": "json",
},
)
result = resp.json()["login"]["result"]
login_obj = resp.json().get("login", {})
result = login_obj.get("result")
if result != "Success":
print(f"Login failed: {result}", file=sys.stderr)
# MW returns a `reason` field on Failed/Aborted responses that
# explains the actual cause (wrong password, account locked, IP
# restriction, bot password deleted, etc.). Surface it so CI
# failures are diagnosable from the logs without re-running.
# The `details` field carries additional context when present.
reason = login_obj.get("reason", "(no reason returned)")
details = login_obj.get("details")
extra = f" — {details}" if details else ""
print(f"Login failed: {result} — {reason}{extra}", file=sys.stderr)
sys.exit(1)

def get_csrf_token(self):
Expand Down
Loading