Page MenuHomePhabricator

import of compat SVN working copy requires internet connection
Closed, DeclinedPublic

Description

Author: sebastian.bank

Description:
wikipedia.py retrieves version.getversiondict()["rev"] to set the User-agent when imported.

https://gerrit.wikimedia.org/r/#/c/86374/ changed version.getversion_svn() to unconditionally ask github for the git-hash. However, the hash itself isn't actually used in wikipedia.py (see also https://bugzilla.wikimedia.org/show_bug.cgi?id=54686).

This undermines e.g. to unpickle previously saved page objects when access to github.com does not work. It also seems an unpleasant thing, to make such a roundtrip every time the library is imported, right?

Maybe getversiondict() and the code it dispatches to can get an opt-out (not to retrieve information by speaking to the network) to be used in the User-agent case.

>>> import wikipedia

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import wikipedia
  File "wikipedia.py", line 6023, in <module>
    versionrev=(version.getversiondict()["rev"])
  File "pywikibot\version.py", line 58, in getversiondict
    (tag, rev, date, hsh) = getversion_svn(_program_dir)
  File "pywikibot\version.py", line 151, in getversion_svn
    {'Label': rev, 'User-Agent': 'SVN/1.7.5-pywikibot1'})
  File "C:\Program Files\Python27\lib\httplib.py", line 995, in request
    self._send_request(method, url, body, headers)
  File "C:\Program Files\Python27\lib\httplib.py", line 1029, in _send_request
    self.endheaders(body)
  File "C:\Program Files\Python27\lib\httplib.py", line 991, in endheaders
    self._send_output(message_body)
  File "C:\Program Files\Python27\lib\httplib.py", line 844, in _send_output
    self.send(msg)
  File "C:\Program Files\Python27\lib\httplib.py", line 806, in send
    self.connect()
  File "C:\Program Files\Python27\lib\httplib.py", line 1194, in connect
    self.timeout, self.source_address)
  File "C:\Program Files\Python27\lib\socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno 11004] getaddrinfo failed

Pywikibot: pywikibot-compat (8317312, s11008, 2014/07/27, 11:54:19, ok)
Release version: 1.0b1
Python: 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]
config-settings:
use_api = True
use_api_login = True
unicode test: ok


Version: compat-(1.0)
Severity: normal

Details

Reference
bz68725

Related Objects

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:26 AM
bzimport set Reference to bz68725.
jayvdb set Security to None.
Aklapper triaged this task as Lowest priority.Jun 5 2015, 1:41 PM
Aklapper subscribed.

Pywikibot has two versions: Compat and Core. This task was filed about the older version, called Pywikibot-compat, which is not under active development anymore. Hence I'm lowering the priority of this task to reflect the reality. Unfortunately, the Pywikibot team does not have the manpower to retest every single bug report / feature request against the (maintained) Pywikibot code base. Furthermore, the code base of Pywikibot-Compat has changed a lot compared to the code base of Pywikibot-Core so there is a chance that the problem described in this task might not exist anymore. Please help: Unfortunately manpower is limited and does not allow testing every single reported task again. If you have time and interest in Pywikibot, please upgrade to Pywikibot-Core and add a comment to this task if the problem in this task still happens in Pywikibot-Core (or directly edit the task by removing the Pywikibot-compat project and adding the Pywikibot project to this task). To learn more about Pywikibot and to get involved in its development, please check out https://www.mediawiki.org/wiki/Manual:Pywikibot/Development Thank you for your understanding.

Fixed in core; unlikely to be fixed in compat.