ensure streaming mode (use for example by file.managed) will works for requests backend

This commit is contained in:
Alexander Schwartz 2016-04-02 20:32:33 +00:00
parent 664043d7e7
commit a867d23383

View File

@ -299,7 +299,16 @@ def query(url,
method, url, params=params, data=data, **req_kwargs method, url, params=params, data=data, **req_kwargs
) )
result.raise_for_status() result.raise_for_status()
if stream is True or handle is True: if stream is True:
# fake a HTTP response header
header_callback('HTTP/1.0 {0} MESSAGE'.format(result.status_code))
# fake streaming the content
streaming_callback(result.content)
return {
'handle': result,
}
if handle is True:
return { return {
'handle': result, 'handle': result,
'body': result.content, 'body': result.content,