Page MenuHomePhabricator

Protocol in -weblink should be handled instead of resulting in APIError
Closed, ResolvedPublic

Description

If http.s (or other ptocol?) is present in the queried domain, user should be informed by either listpages.py script or by LinksearchPageGenerator's pagegenerator that it is not excepted to be present in it.

$ python3 pwb.py listpages -weblink:"http://*.blog.me"
WARNING: API error badquery: Invalid query.
Traceback (most recent call last):
  File "pwb.py", line 390, in <module>
    if not main():
  File "pwb.py", line 385, in main
    file_package)
  File "pwb.py", line 101, in run_python_file
    main_mod.__dict__)
  File "./scripts/listpages.py", line 285, in <module>
    main()
  File "./scripts/listpages.py", line 257, in main
    for i, page in enumerate(gen, start=1):
  File "pywikibot-core/pywikibot/data/api.py", line 2823, in __iter__
    self.data = self.request.submit()
  File "pywikibot-core/pywikibot/data/api.py", line 2091, in submit
    raise APIError(**result['error'])
pywikibot.data.api.APIError: badquery: Invalid query.
[help: See https://fr.wikipedia.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'>

$ python3 pwb.py listpages -weblink:"*.blog.me"
   1 Tcfc2349
1 page(s) found

Event Timeline

Framawiki created this task.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald Transcript

Change 593055 had a related patch set uploaded (by Framawiki; owner: Framawiki):
[pywikibot/core@master] [FEAT] pagegenerators: handle protocols in -weblink

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

Change 593055 merged by jenkins-bot:
[pywikibot/core@master] [FEAT] pagegenerators: handle protocols in -weblink

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