jenkins-bot has submitted this change and it was merged.
Change subject: [FEAT] ParamInfo: Guess write using mustbeposted ......................................................................
[FEAT] ParamInfo: Guess write using mustbeposted
Almost all default write actions (apart from purge) must be POSTed so it can guess that actions that are POSTed (except for login) are also write actions.
Change-Id: I65fa9ffcfd25f18d8589160485c3c5a318f0a046 --- M pywikibot/data/api.py 1 file changed, 9 insertions(+), 0 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved Ricordisamoa: Looks good to me, but someone else must approve jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 71cc0a9..a998d2a 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -494,6 +494,15 @@ if (help_text.find('\n\nThis module only accepts POST ' 'requests.\n', start) < end): self._paraminfo[path]['mustbeposted'] = '' + # All actions which must be POSTed are write actions except for + # login. Because Request checks if the user is logged in when + # doing a write action the check would always fail on login. + # Purge is the only action which isn't POSTed but actually does + # require writerights. This was checked with the data from + # 1.25wmf22 on en.wikipedia.org. + if ('mustbeposted' in self._paraminfo[path] and + path != 'login') or path == 'purge': + self._paraminfo[path]['writerights'] = ''
self._emulate_pageset()