Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

Adding support to download be stream of data #170

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
09d80fb
Supporting big files
guydou Dec 10, 2017
ce0b6be
fix a bug
guydou Dec 10, 2017
4147bd9
allowing streaming on action
guydou Dec 10, 2017
552bce2
setting the stream part of the request
guydou Dec 10, 2017
a0efe9c
the stream should be part of the session
guydou Dec 10, 2017
5b05715
when mocking send we should get **kwargs since that is the signature …
guydou Dec 10, 2017
b597738
fixing test to support streaming
guydou Dec 10, 2017
7b4d4e1
fixing test to python3
guydou Dec 10, 2017
03a1317
dealing with the case the decoder returned a file
guydou Dec 10, 2017
fb1ca07
Supporting the case where there is error and DownloadCoded is enabled
guydou Dec 10, 2017
4f7d723
Merge branch 'error-with-download-coded' into dealing_with_errors_in_…
guydou Dec 11, 2017
3438917
when uploading file making sure it uses multipart/form
guydou Dec 12, 2017
fcc52c0
adding progress_bar to download
guydou Aug 15, 2018
7a93524
adding tqdm dep
guydou Aug 15, 2018
77c7680
Merge branch 'master' into adding_progress_bar_to_download
guydou Aug 15, 2018
a535c65
remore extra lines
guydou Aug 15, 2018
9edaf40
Update test_transport.py
guydou Aug 15, 2018
bf6191e
Update test_transport.py
guydou Aug 15, 2018
43a719b
Update requirements.txt
guydou Aug 15, 2018
3f50c5c
coding style
guydou Aug 15, 2018
2a45d03
Merge branch 'adding_progress_bar_to_download' of https://github.com/…
guydou Aug 15, 2018
0668871
code style
guydou Aug 15, 2018
8fb5573
Supporting the case where there is error and DownloadCoded is enabled
guydou Dec 10, 2017
6be714d
Merge branch 'master' into adding_progress_bar_to_download
guydou Aug 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
setting the stream part of the request
  • Loading branch information
guydou committed Dec 10, 2017
commit 552bce22c226ae94a57e5ced440512643bc4c39a
7 changes: 4 additions & 3 deletions coreapi/transports/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _get_upload_headers(file_obj):
}


def _build_http_request(session, url, method, headers=None, encoding=None, params=empty_params):
def _build_http_request(session, url, method, headers=None, encoding=None, params=empty_params, stream=False):
"""
Make an HTTP request and return an HTTP response.
"""
Expand All @@ -210,6 +210,7 @@ def _build_http_request(session, url, method, headers=None, encoding=None, param

if params.query:
opts['params'] = params.query
opts['stream'] = stream

if params.data or params.files:
if encoding == 'application/json':
Expand Down Expand Up @@ -376,8 +377,8 @@ def transition(self, link, decoders, params=None, link_ancestors=None, force_cod
headers = _get_headers(url, decoders)
headers.update(self.headers)

request = _build_http_request(session, url, method, headers, encoding, params)
with session.send(request, stream=stream) as response:
request = _build_http_request(session, url, method, headers, encoding, params, stream=stream)
with session.send(request) as response:
result = _decode_result(response, decoders, force_codec)

if isinstance(result, Document) and link_ancestors:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy