jenkins-bot submitted this change.
Pass login token when using action=login
This will take care of the warning currently shown when logging in
using a BotPassword, where MediaWiki API warns that fetching a
token via "action=login" is deprecated. We already have fetched
the token and we just need to provide it here.
Bug: T309898
Change-Id: I77d22d1d4d3a3dc66abe3a64107c59ec37ea3a2a
---
M pywikibot/login.py
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 4ce3eea..17c6924 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -348,7 +348,6 @@
if botpassword:
self.action = 'login'
else:
- token = self.site.tokens['login']
self.action = 'clientlogin'
# prepare default login parameters
@@ -356,11 +355,14 @@
self.keyword('user'): self.login_name,
self.keyword('password'): self.password}
+ if self.action == 'login':
+ parameters['lgtoken'] = self.site.tokens['login']
+
if self.action == 'clientlogin':
# clientlogin requires non-empty loginreturnurl
parameters['loginreturnurl'] = 'https://example.com'
parameters['rememberMe'] = '1'
- parameters['logintoken'] = token
+ parameters['logintoken'] = self.site.tokens['login']
if self.site.family.ldapDomain:
parameters[self.keyword('ldap')] = self.site.family.ldapDomain
To view, visit change 990720. To unsubscribe, or for help writing mail filters, visit settings.