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

Allow Requests.Response to be used as a context manager #4137

Merged
merged 1 commit into from
Jun 7, 2017

Commits on Jun 6, 2017

  1. Allow Requests.Response to be used as a context manager

    This saves having to wrap the call to requests with
    `contextlib.closing()`, allowing it to be used directly in a
    `with` statement, like so:
    
    ```
    with requests.get('http://httpbin.org/get', stream=True) as r:
        # Do things with the response here.
    ```
    
    Fixes psf#4136.
    edmorley committed Jun 6, 2017
    Configuration menu
    Copy the full SHA
    4847f5b View commit details
    Browse the repository at this point in the history