Page MenuHomePhabricator

interwikidata.py throws pywikibot.data.api.APIError: param-missing: Either provide the Item "ids" or pairs of "sites" and "titles" for corresponding page
Open, Needs TriagePublic

Description

Script started on 2020-10-20 23:26:49+0000
urbanecm@titanium (master u=) ~/Documents/git/gerrit/pywikibot/core 

$  python3 pwb.py interwikidata.py -lang:smn -family:wikipedia -clean -start:!
/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/config2.py:1060: _ConfigurationDeprecationWarning: 
"interwiki_contents_on_disk" present in our user-config.py is no
longer a supported configuration variable and should be removed.
Please inform the maintainers if you depend on it.
  _ConfigurationDeprecationWarning)
/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/config2.py:1060: _ConfigurationDeprecationWarning: 
"use_mwparserfromhell" present in our user-config.py is no longer a
supported configuration variable and should be removed. Please inform
the maintainers if you depend on it.
  _ConfigurationDeprecationWarning)
Retrieving 50 pages from wikipedia:smn.


>>> 1111 <<<
No interlanguagelinks on [[1111]]


>>> 12 Years a Slave (elleekove) <<<
No interlanguagelinks on [[12 Years a Slave (elleekove)]]


>>> 1647 <<<
WARNING: API warning (main): Unrecognized parameter: uiprop.
WARNING: API warning (query): Unrecognized value for parameter "meta": userinfo
WARNING: API warning (main): Unrecognized parameter: uiprop.
WARNING: API warning (query): Unrecognized value for parameter "meta": userinfo
WARNING: API warning (main): Unrecognized parameter: uiprop.
WARNING: API warning (query): Unrecognized value for parameter "meta": userinfo
WARNING: API warning (wbgetentities): Unrecognized value for parameter "sites": smnwiki
WARNING: API error param-missing: Either provide the Item "ids" or pairs of "sites" and "titles" for corresponding page

2 pages read
0 pages written
0 pages skipped
Execution time: 2 seconds
Read operation time: 1.0 seconds
Script terminated by exception:

ERROR: APIError: param-missing: Either provide the Item "ids" or pairs of "sites" and "titles" for corresponding page
[messages: [{'name': 'wikibase-api-illegal-ids-or-sites-titles-selector', 'parameters': [], 'html': {'*': 'Either provide the Item "ids" or pairs of "sites" and "titles" for corresponding page'}}];
 help: See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]
Traceback (most recent call last):
  File "pwb.py", line 363, in <module>
    if not main():
  File "pwb.py", line 358, in main
    file_package)
  File "pwb.py", line 75, in run_python_file
    main_mod.__dict__)
  File "./scripts/interwikidata.py", line 245, in <module>
    main()
  File "./scripts/interwikidata.py", line 239, in main
    bot.run()
  File "/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/bot.py", line 1498, in run
    self.treat(page)
  File "/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/bot.py", line 1777, in treat
    self.treat_page()
  File "./scripts/interwikidata.py", line 86, in treat_page
    item = pywikibot.ItemPage.fromPage(self.current_page)
  File "/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/page/__init__.py", line 4541, in fromPage
    if not lazy_load and not i.exists():
  File "/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/page/__init__.py", line 4165, in exists
    self.get(get_redirect=True)
  File "/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/page/__init__.py", line 4595, in get
    data = super().get(force, *args, **kwargs)
  File "/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/page/__init__.py", line 4203, in get
    data = WikibaseEntity.get(self, force=force)
  File "/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/page/__init__.py", line 3957, in get
    data = self.repo.loadcontent(identification)
  File "/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/site/__init__.py", line 7084, in loadcontent
    data = req.submit()
  File "/home/urbanecm/Documents/git/gerrit/pywikibot/core/pywikibot/data/api.py", line 1994, in submit
    raise APIError(**result['error'])
pywikibot.data.api.APIError: param-missing: Either provide the Item "ids" or pairs of "sites" and "titles" for corresponding page
[messages: [{'name': 'wikibase-api-illegal-ids-or-sites-titles-selector', 'parameters': [], 'html': {'*': 'Either provide the Item "ids" or pairs of "sites" and "titles" for corresponding page'}}];
 help: See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.data.api.APIError'>
urbanecm@titanium (master u=) ~/Documents/git/gerrit/pywikibot/core 

$ exit

Script done on 2020-10-20 23:27:12+0000

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptOct 20 2020, 11:28 PM

Unrecognised value for parameter "sites": smnwiki

Something missing on mw api side?

Xqt added a subscriber: zhuyifei1999.

Looks like userinfo call does not work

Unrecognised value for parameter "sites": smnwiki

Something missing on mw api side?

I tested the userinfo call, and it works as expected, so I think it's a PWB bug.

Unrecognized value for parameter "sites": smnwiki

Might be on Wikidata end.

I experience the same error intermittently with my bot. To test this I wrote code that sends the same query in a loop and sometimes it gets the correct reply from the server while sometimes this happens:

{
  "batchcomplete": "",
  "warnings": {
    "query": {
      "*": "Unrecognized value for parameter \"meta\": userinfo"
    }
  }
}

This is the request I'm sending repeatedly (as POST body) to https://ru.wikipedia.org/w/api.php:
meta=userinfo&action=query&continue=&format=json

Meno25 added a subscriber: Meno25.Oct 21 2020, 12:07 PM

Unrecognised value for parameter "sites": smnwiki

Something missing on mw api side?

I tested the userinfo call, and it works as expected, so I think it's a PWB bug.

I get this warning as well when running redirect.py:

python3 pwb.py redirect broken -delete -fullscan -lang:ar -family:wiktionary

Output is:

......WARNING: API warning (query): Unrecognized value for parameter "meta": userinfo
WARNING: API warning (main): Unrecognized parameter: uiprop.

0 pages read
0 pages written
0 pages skipped
Execution time: 8 seconds
Script terminated successfully.

Also CI Tests Fails sometimes

Which may indicate PWB bug just as this does. Adding Wikidata item just to be sure.

This definitely has nothing to do with PWB. I get this error by just running the bare query like I said above

Xqt added a comment.Oct 22 2020, 1:45 PM

Which may indicate PWB bug just as this does. Adding Wikidata item just to be sure.

This is a temporay wrong response on MW side I guess. There is a similar case in T242083 where insufficient response is retrieved mostly influenced due to wikidata overload. The last CI build passed now but the described behaviour may be come again I fear.

Xqt added a comment.Oct 23 2020, 12:14 AM

Maybe it's because T264963: Add Wikidata support for smnwiki was resolved?

Probably yes but it looks very strange to get such an invalid response. See Meno25's note above; don’t see a wikidata call there.

Maybe it's because T264963: Add Wikidata support for smnwiki was resolved?

Probably yes but it looks very strange to get such an invalid response. See Meno25's note above; don’t see a wikidata call there.

Just thought I should report this, I tried the same command today and the warning disappeared:

python3 pwb.py redirect broken -delete -fullscan -lang:ar -family:wiktionary

Output is:

......
0 pages read
0 pages written
0 pages skipped
Execution time: 4 seconds
Script terminated successfully.

Output of version.py:

Pywikibot: [https] r-pywikibot-core (ae216e1, g13535, 2020/10/31, 17:08:58, master)
Release version: 5.1.0.dev0
requests version: 2.21.0
  cacerts: /etc/ssl/certs/ca-certificates.crt
    certificate test: ok
Python: 3.5.3 (default, Jul  9 2020, 13:00:10)
[GCC 6.3.0 20170516]