Do not prefetch content with requests >= 1.0
This commit is contained in:
parent
67836942d8
commit
14f0a6fe78
1 changed files with 4 additions and 1 deletions
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue