Page MenuHomePhabricator

Either enable captcha for not autoconfirmed user or show an error message other than a "KeyError: 'messagecode'"
Closed, ResolvedPublic

Description

Captcha handling is not supported currently I guess. Maybe it was previously. Either (re-)enable captcha for not autoconfirmed users or show a more informative error message. (See https://www.mediawiki.org/wiki/Topic:Vrl03a6g6zrlpgps)

Traceback (most recent call last):
  File "pwb.py", line 360, in <module>
   if not main():
  File "pwb.py", line 352, in main
   run_python_file(filename,
  File "pwb.py", line 73, in run_python_file
   exec(compile(source, filename, 'exec', dont_inherit=True),
  File "./scripts/login.py", line 185, in <module>
   main()
  File "./scripts/login.py", line 167, in main
   site.login(autocreate=autocreate)
  File "/home/yutkeej/pywikibot/pywikibot/tools/__init__.py", line 1499, in wrapper
   return obj(*__args, **__kw)
  File "/home/yutkeej/pywikibot/pywikibot/site/__init__.py", line 1931, in login
   if login_manager.login(retry=True, autocreate=autocreate):
  File "/home/yutkeej/pywikibot/pywikibot/login.py", line 301, in login
   cookiedata = self.getCookie()
  File "/home/yutkeej/pywikibot/pywikibot/tools/__init__.py", line 1584, in wrapper
   return obj(*new_args, **new_kwargs)
  File "/home/yutkeej/pywikibot/pywikibot/data/api.py", line 3197, in getCookie
   and (response['messagecode'] == 'login-throttled'
KeyError: 'messagecode'
CRITICAL: Exiting due to uncaught exception <class 'KeyError'>

Event Timeline

Change 645822 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [IMPR] Add additional info into log if 'messagecode' is missing during login

https://gerrit.wikimedia.org/r/645822

Change 645822 merged by jenkins-bot:
[pywikibot/core@master] [IMPR] Add additional info into log if 'messagecode' is missing during login

https://gerrit.wikimedia.org/r/645822

@WolfgangFahl: Thank you for your report T297997. I don't think that your repository is 6.6.0 because there was the code change

Could you please verify.
See also https://codesearch.wmcloud.org/pywikibot/?q=messagecode&i=nope&files=&excludeFiles=&repos=

@Xqt - you are right might have been 6.0.1 - I'll watch the situation. Currently py-3rdparty-mediawiki uses semantic depencency:

# MediaWiki bot package
# https://pypi.org/project/pywikibot/
# https://www.mediawiki.org/wiki/Manual:Pywikibot
pywikibot~=6.6.3
Xqt claimed this task.

show an error message other than a "KeyError: 'messagecode'" is already solved. I close it then. Please re-open if there is something remaining to be done.