Do not prefetch content with requests >= 1.0

This commit is contained in:
Bastian Kleineidam 2013-02-11 19:45:21 +01:00
parent 67836942d8
commit 14f0a6fe78

View file

@ -225,7 +225,10 @@ def urlopen(url, referrer=None, max_content_bytes=None,
"headers": headers, "headers": headers,
"timeout": timeout, "timeout": timeout,
} }
if not hasattr(requests, 'adapters'): if hasattr(requests, 'adapters'):
# requests >= 1.0
kwargs["stream"] = True
else:
# requests << 1.0 # requests << 1.0
kwargs["prefetch"] = False kwargs["prefetch"] = False
kwargs["config"] = {"max_retries": MaxRetries} kwargs["config"] = {"max_retries": MaxRetries}