Skip to content
Discussion options

You must be logged in to vote

It's absolutely a deliberate design decision.

Having a stream=True parameter is a code-smell, and lets you do two different kinds of broken things...

with client.get("https://www.example.com") as response:
    # The response isn't actually open here, but the code makes it look like it is.
    ...

...or this case, which is worse...

response = client.get("https://www.example.com", stream=True)
# We'd better close the response or we'll end up with a hanging connection in the connection pool.

We've deliberately opted for a more constrained style here that is always explicit about when a streaming response is opened and closed.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lovelydinosaur
Comment options

Answer selected by zanieb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants