Page MenuHomePhabricator

Calling any script passing the -help argument, performs an api call to the default configured wiki
Closed, ResolvedPublic


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
File "/path/pywikibot/comms/", line 184, in request

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.

Version: core-(2.0)
Severity: minor



Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:35 AM
bzimport set Reference to bz69895.
bzimport added a subscriber: Unknown Object (????).

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.

Change 157799 had a related patch set uploaded by John Vandenberg:
Remove user messages check during startup

Change 166583 had a related patch set uploaded by John Vandenberg:
Dont load site at startup to log site version

Change 157799 merged by jenkins-bot:
Remove user messages check during startup

Change 166583 merged by jenkins-bot:
Dont load site at startup to log site version