Page MenuHomePhabricator

both action does not work for redirect.py if user has no bot rights
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):
pwb redirect -simulate -lang:de both

What happens?:

.WARNING: API error toomanyvalues: Too many values supplied for parameter "pageids". The limit is 50.

0 pages read
0 pages written
0 pages skipped
Execution time: 5 seconds
Script terminated by exception:

ERROR: APIError: toomanyvalues: Too many values supplied for parameter "pageids". The limit is 50.
[limit: 50;
 lowlimit: 50;
 highlimit: 500;
 help: See https://de.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes.]
Traceback (most recent call last):
  File "C:\pwb\GIT\core\pwb.py", line 494, in <module>
    main()
  File "C:\pwb\GIT\core\pwb.py", line 478, in main
    if not execute():
  File "C:\pwb\GIT\core\pwb.py", line 462, in execute
    run_python_file(filename, script_args, module)
  File "C:\pwb\GIT\core\pwb.py", line 143, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\redirect.py", line 733, in <module>
    main()
  File ".\scripts\redirect.py", line 729, in main
    bot.run()
  File "C:\pwb\GIT\core\pywikibot\bot.py", line 1577, in run
    for item in self.generator:
  File "C:\pwb\GIT\core\pywikibot\bot.py", line 1575, in <genexpr>
    self.generator = (item for item in self.generator)
  File ".\scripts\redirect.py", line 259, in get_redirects_via_api
    data = gen.submit()
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 1868, in submit
    raise pywikibot.exceptions.APIError(**result['error'])
pywikibot.exceptions.APIError: toomanyvalues: Too many values supplied for parameter "pageids". The limit is 50.
[limit: 50;
 lowlimit: 50;
 highlimit: 500;
 help: See https://de.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/&gt; for notice of API deprecations and breaking changes.]
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.APIError'>

C:\pwb\GIT\core>

What should have happened instead?:
The limit should be determined first for _next_redirect_group method. len(apiQ) >= 500 might be ok for bots but fails here for some others.
https://codesearch.wmcloud.org/pywikibot/?q=len%5C(apiQ%5C)%20%3E%3D%2050&i=nope&files=&excludeFiles=&repos=

Event Timeline

Xqt triaged this task as Medium priority.Jan 23 2022, 11:23 AM
Xqt updated the task description. (Show Details)
Xqt renamed this task from both action does not work anymore for redirect.py to both action does not work for redirect.py if user hs no bot rights.Jan 23 2022, 11:29 AM
Xqt removed a project: Regression.

Change 756165 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Always use low limit for bulk load of redirects

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

Xqt renamed this task from both action does not work for redirect.py if user hs no bot rights to both action does not work for redirect.py if user has no bot rights.Jan 23 2022, 3:15 PM
Xqt removed Xqt as the assignee of this task.Jan 24 2022, 5:35 AM
Xqt lowered the priority of this task from Medium to Lowest.

Change 756165 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Always use low limit for bulk load of redirects

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

Change 761583 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Use site.maxlimit to determine the highest limit to load

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

Can site.maxlimit be used?

works with it.

Change 761583 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Use site.maxlimit to determine the highest limit to load

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

Xqt claimed this task.