From 14f0a6fe7880c63ffc1bd214383e0bb57c752ecc Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Mon, 11 Feb 2013 19:45:21 +0100 Subject: [PATCH] Do not prefetch content with requests >= 1.0 --- dosagelib/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dosagelib/util.py b/dosagelib/util.py index 44d6c54da..891061ba2 100644 --- a/dosagelib/util.py +++ b/dosagelib/util.py @@ -225,7 +225,10 @@ def urlopen(url, referrer=None, max_content_bytes=None, "headers": headers, "timeout": timeout, } - if not hasattr(requests, 'adapters'): + if hasattr(requests, 'adapters'): + # requests >= 1.0 + kwargs["stream"] = True + else: # requests << 1.0 kwargs["prefetch"] = False kwargs["config"] = {"max_retries": MaxRetries}