I just upgraded pywikibot from quite an old version (from around 2014), worked for a day or so just fine, and then (I guess the cookie expired), login doesn't work any more.
What I usually did:
- do edits from the bot normally. From time to time, it requested the password. I typed it in, and it went on merrily for at least a couple weeks.
After the update (running [https] r-pywikibot-core.git (d21ee03, g7381, 2016/08/04, 08:27:53, n/a) on Linux. Tried with two systems. One, running python 2.7.3; the other, an up-to-date Ubuntu running python 2.7-12:
- when I try to do a Page.put, I get the following errors:
File "/home/bot/.pywikibot/core/pywikibot/tools/__init__.py", line 1414, in wrapper return obj(*__args, **__kw) File "/home/bot/.pywikibot/core/pywikibot/page.py", line 1279, in put **kwargs) File "/home/bot/.pywikibot/core/pywikibot/tools/__init__.py", line 1414, in wrapper return obj(*__args, **__kw) File "/home/bot/.pywikibot/core/pywikibot/page.py", line 1196, in save cc=apply_cosmetic_changes, quiet=quiet, **kwargs) File "/home/bot/.pywikibot/core/pywikibot/page.py", line 1207, in _save watch=watch, bot=botflag, **kwargs) File "/home/bot/.pywikibot/core/pywikibot/site.py", line 1300, in callee self.login(False) File "/home/bot/.pywikibot/core/pywikibot/site.py", line 2057, in login if loginMan.login(retry=True): File "/home/bot/.pywikibot/core/pywikibot/login.py", line 276, in login cookiedata = self.getCookie() File "/home/bot/.pywikibot/core/pywikibot/data/api.py", line 3033, in getCookie prefix = login_result['login']['cookieprefix'] KeyError: u'cookieprefix' <type 'exceptions.KeyError'> CRITICAL: Closing network session.
If I type the wrong password, it just keeps asking for it. It only crashes when I enter the right password.
On the fresh install, I tried just the minimum:
- install from git
- create user-config.py with the generate_user_files.py utility.
- python pwb.py login
- enter password
I get:
WARNING: API warning (login): Main-account login via action=login is deprecated and may stop working without warning. To continue login with action=login, see [[Special:BotPasswords]]. To safely continue using main-account login, see action=clientlogin. Traceback (most recent call last): File "pwb.py", line 257, in <module> if not main(): File "pwb.py", line 251, in main run_python_file(filename, [filename] + args, argvu, file_package) File "pwb.py", line 121, in run_python_file main_mod.__dict__) File "./scripts/login.py", line 193, in <module> main() File "./scripts/login.py", line 176, in main site.login(sysop) File "/home/bot/.pywikibot/core/pywikibot/site.py", line 2057, in login if loginMan.login(retry=True): File "/home/bot/.pywikibot/core/pywikibot/login.py", line 276, in login cookiedata = self.getCookie() File "/home/bot/.pywikibot/core/pywikibot/data/api.py", line 3033, in getCookie prefix = login_result['login']['cookieprefix'] KeyError: u'cookieprefix' <type 'exceptions.KeyError'> CRITICAL: Closing network session.
This is completely reproducible, at least with my user. I find it impossible to login and I've tried two systems: the one where I usually do all the work, and a fresh install in an up-to-date Ubuntu.
In case you need to know, site is ca.wikipedia, where my bot is registered.
I have edited api.py, to have it print login_result. It's
{u'login': {u'lguserid': 77777, u'result': u'Success', u'lgusername': u'xxxxxxx'}, u'warnings': {u'login': {u'*': u'Main-account login via action=login is deprecated and may stop working without warning. To continue login with action=login, see [[Special:BotPasswords]]. To safely continue using main-account login, see action=clientlogin.'}}}
So, no cookie.