Last modified: 2014-11-16 01:44:05 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T71895, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 69895 - Calling any script passing the -help argument, performs an api call to the default configured wiki
Calling any script passing the -help argument, performs an api call to the de...
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
All All
: High minor
: ---
Assigned To: Pywikipedia bugs
Depends on:
Blocks: pwb20
  Show dependency treegraph
Reported: 2014-08-22 10:56 UTC by Jesús Martínez Novo (Ciencia Al Poder)
Modified: 2014-11-16 01:44 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Jesús Martínez Novo (Ciencia Al Poder) 2014-08-22 10:56:56 UTC
When calling any script with the -help argument to see the parameters it can handle, the bot makes a call to the api of the default configured wiki.

I noticed it because my default configured wiki is a test wiki hosted locally, and I have the webserver stopped when I don't need it running. When I need to run the bot, I manually specify -family:WHATEVER

Under that circumstances, every attempt to run -help on any script causes an error because the default configured wiki-family is not accessible:

$ python -help
> ERROR: Traceback (most recent call last):
>   File "/path/pywikibot/data/", line 341, in submit
>     body=paramstring)
>   File "/path/pywikibot/comms/", line 184, in request
>     raise
> error: [Errno 111] Connection refused
> WARNING: Waiting 5 seconds before retrying.
> ^CTraceback (most recent call last):
>   File "", line 171, in <module>
>     run_python_file(fn, argv, argvu)
>   File "", line 69, in run_python_file
>     exec(compile(source, filename, "exec"), main_mod.__dict__)
>   File "scripts/", line 685, in <module>
>     main()
>   File "scripts/", line 483, in main
>     local_args = pywikibot.handleArgs(*args)
>   File "/path/pywikibot/", line 666, in handleArgs
>     init_handlers()
>   File "/path/pywikibot/", line 248, in init_handlers
>     writelogheader()
>   File "/path/pywikibot/", line 318, in writelogheader
>     log(u'SITE VERSION: %s' % unicode(site.live_version()))
>   File "/path/pywikibot/", line 1877, in live_version
>     expiry=0 if force else 1)
>   File "/path/pywikibot/", line 1097, in get
>     preloaded = self._get_general(key, expiry)
>   File "/path/pywikibot/", line 1043, in _get_general
>     default_info = self._get_siteinfo(props, expiry)
>   File "/path/pywikibot/", line 967, in _get_siteinfo
>     siprop='|'.join(props)).submit()
>   File "/path/pywikibot/data/", line 580, in submit
>     self._data = super(CachedRequest, self).submit()
>   File "/path/pywikibot/data/", line 358, in submit
>     self.wait()
>   File "/path/pywikibot/data/", line 469, in wait
>     time.sleep(self.retry_wait)
> KeyboardInterrupt
> <type 'exceptions.KeyboardInterrupt'>

Of course, it works when I have apache running, but such connections seem unnecessary when the bot doesn't have to run anything.
Comment 1 John Mark Vandenberg 2014-08-22 11:08:48 UTC
Indeed.  I was going to raise this bug myself, as it is preventing automated testing of the scripts before code review (as the WMF test boxes are not supposed to make network connections).,unified

In addition to disabling connecting to the wiki for '-help', we should offer to disable that call to site.live_version() in the startup sequence for _all_ commands.  I did a partial solution in , but there is still more unnecessary network activity during startup.
Comment 2 Gerrit Notification Bot 2014-10-14 12:51:31 UTC
Change 157799 had a related patch set uploaded by John Vandenberg:
Remove user messages check during startup
Comment 3 Gerrit Notification Bot 2014-10-14 15:30:39 UTC
Change 166583 had a related patch set uploaded by John Vandenberg:
Dont load site at startup to log site version
Comment 4 Gerrit Notification Bot 2014-11-07 05:43:18 UTC
Change 157799 merged by jenkins-bot:
Remove user messages check during startup
Comment 5 John Mark Vandenberg 2014-11-09 20:21:29 UTC
One merged; one more to go.
Comment 6 Gerrit Notification Bot 2014-11-16 00:47:45 UTC
Change 166583 merged by jenkins-bot:
Dont load site at startup to log site version

Note You need to log in before you can comment on or make changes to this bug.