Page MenuHomePhabricator

requests version on labs fails with (x,y) timeout argument
Closed, ResolvedPublic


This happens both on precise and trusty.

ERROR: Traceback (most recent call last):
  File "/home/valhallasw/src/pywikibot-core/pywikibot/data/", line 1699, in submit
    body=body, headers=headers)
  File "/home/valhallasw/src/pywikibot-core/pywikibot/tools/", line 1186, in wrapper
    return obj(*__args, **__kw)
  File "/home/valhallasw/src/pywikibot-core/pywikibot/comms/", line 238, in request
    r = fetch(baseuri, method, body, headers, **kwargs)
  File "/home/valhallasw/src/pywikibot-core/pywikibot/comms/", line 350, in fetch
    request = _enqueue(uri, method, body, headers, **kwargs)
  File "/home/valhallasw/src/pywikibot-core/pywikibot/comms/", line 332, in _enqueue
    _http_process(session, request)
  File "/home/valhallasw/src/pywikibot-core/pywikibot/comms/", line 250, in _http_process
    verify=True, timeout=timeout)
  File "/usr/lib/python2.7/dist-packages/requests/", line 357, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/", line 460, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/", line 305, in send
    timeout = TimeoutSauce(connect=timeout, read=timeout)
  File "/usr/lib/python2.7/dist-packages/urllib3/", line 116, in __init__
    self._connect = self._validate_timeout(connect, 'connect')
  File "/usr/lib/python2.7/dist-packages/urllib3/", line 147, in _validate_timeout
    "int or float." % (name, value))
ValueError: Timeout value connect was (30, 120), but it must be an int or float.

Event Timeline

valhallasw raised the priority of this task from to Needs Triage.
valhallasw updated the task description. (Show Details)
valhallasw added a project: Pywikibot.
valhallasw added a subscriber: valhallasw.

With d3678819 the requests' timeout parameter is used and by default using a tuple. And it appears that older versions of requests or urllib3 don't support that yet. So a quick fix would be to set the default timeout to just a int. The other question is whether requests or urllib3 add support for that and we need to add a version check accordingly and can then just use the lower of the two values and maybe inform the user.

Okay requests 2.4.0 adds support for multiple timeouts although it's unclear if that is because of urllib3. Looking into urllib3's documentation it does support complex timeouts but doesn't use a tuple for this so requests version 2.4.0 might still be needed to convert it into an urllib3 compatible type.

Change 219441 had a related patch set uploaded (by XZise):
[FIX] Use only a single timeout

Change 219441 merged by jenkins-bot:
[FIX] Use only a single timeout

jayvdb claimed this task.
XZise set Security to None.

There are several failures on . Some of them we already know, like T101138 and maybe T91394 cropping up again. It would be good to know what other bugs there are in different versions.