https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
Bug ID: 69895
Summary: Calling any script passing the -help argument,
performs an api call to the default configured wiki
Product: Pywikibot
Version: core (2.0)
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: General
Assignee: Pywikipedia-bugs(a)lists.wikimedia.org
Reporter: martineznovo(a)gmail.com
Web browser: ---
Mobile Platform: ---
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 pwb.py replace.py -help
ERROR: Traceback (most recent call last):
File "/path/pywikibot/data/api.py", line 341, in submit
body=paramstring)
File "/path/pywikibot/comms/http.py", line 184, in request
raise request.data
error: [Errno 111] Connection refused
WARNING: Waiting 5 seconds before retrying.
^CTraceback (most recent call last):
File "pwb.py", line 171, in <module>
run_python_file(fn, argv, argvu)
File "pwb.py", line 69, in run_python_file
exec(compile(source, filename, "exec"), main_mod.__dict__)
File "scripts/replace.py", line 685, in <module>
main()
File "scripts/replace.py", line 483, in main
local_args = pywikibot.handleArgs(*args)
File "/path/pywikibot/bot.py", line 666, in handleArgs
init_handlers()
File "/path/pywikibot/bot.py", line 248, in init_handlers
writelogheader()
File "/path/pywikibot/bot.py", line 318, in writelogheader
log(u'SITE VERSION: %s' % unicode(site.live_version()))
File "/path/pywikibot/site.py", line 1877, in live_version
expiry=0 if force else 1)
File "/path/pywikibot/site.py", line 1097, in get
preloaded = self._get_general(key, expiry)
File "/path/pywikibot/site.py", line 1043, in _get_general
default_info = self._get_siteinfo(props, expiry)
File "/path/pywikibot/site.py", line 967, in _get_siteinfo
siprop='|'.join(props)).submit()
File "/path/pywikibot/data/api.py", line 580, in submit
self._data = super(CachedRequest, self).submit()
File "/path/pywikibot/data/api.py", line 358, in submit
self.wait()
File "/path/pywikibot/data/api.py", 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.
--
You are receiving this mail because:
You are the assignee for the bug.