Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get(url, stream=True) does not stream #321

Open
Kamik423 opened this issue Apr 22, 2020 · 1 comment
Open

get(url, stream=True) does not stream #321

Kamik423 opened this issue Apr 22, 2020 · 1 comment

Comments

@Kamik423
Copy link

When using browser.get(url, stream=True) it does not in fact stream, but wait for the entire content to download and add it to the soup. One has to do browser.session.get(...).

This should be documented somewhere or there should be a get_without_adding_to_soup. I spent 3 hours debugging this yesterday, maybe this can save someone some time in the future.

def get(self, *args, **kwargs):
"""Straightforward wrapper around `requests.Session.get
<http://docs.python-requests.org/en/master/api/#requests.Session.get>`__.
:return: `requests.Response
<http://docs.python-requests.org/en/master/api/#requests.Response>`__
object with a *soup*-attribute added by :func:`add_soup`.
"""
response = self.session.get(*args, **kwargs)
if self.raise_on_404 and response.status_code == 404:
raise LinkNotFoundError()
Browser.add_soup(response, self.soup_config)
return response

@hemberger
Copy link
Contributor

Hi, and thanks for reporting this! I agree that there should be some fix for stream=True (or at least documentation to describe how it does/doesn't work). At the moment I'm not exactly sure how we should proceed, but I will note that in #288 another user identified a possible workaround for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants