Skip to content
Myr

Timeouts are normal errors now.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

-- BREAK ALL TEH TESTS!

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 20aed54 · Browse files · 2 files+11 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+11 added−6 removed

  • other:+11 added−6 removed

2 files+11 added−6 removed

modified:requests/models.py+5 added-5 removed
294 unmodified lines
295296 if self.cookiejar is not None:297 self.cookiejar.extract_cookies(resp, req)298299 except urllib2.HTTPError, why:299 except (urllib2.HTTPError, urllib2.URLError), why:300 if hasattr(why, 'reason'):301 if isinstance(why.reason, socket.timeout):302 why = Timeout(why)303304 self._build_response(why)305 if not self.redirect:306 self.response.error = why307304 # TODO: Support urllib connection refused errors305306 except urllib2.URLError, error:307 raise Timeout if isinstance(error.reason, socket.timeout) else error308 else:309 self._build_response(resp)310 self.response.ok = True311
237 unmodified lines
modified:test_requests.py+6 added-1 removed
244 unmodified lines
245 self.assertEquals(r.status_code, 401)246247248 def test_settings(self):249250 def test():251 r = requests.get(httpbin(''))252 r.raise_for_status()253254 with requests.settings(timeout=0.0000001):250 self.assertRaises(requests.Timeout, requests.get, httpbin(''))255 self.assertRaises(requests.Timeout, test)256257 with requests.settings(timeout=100):258 requests.get(httpbin(''))259
68 unmodified lines