GitHub user richardxia opened a pull request:

    https://github.com/apache/libcloud/pull/1006

    LIBCLOUD-901 Correctly wrap requests library Responses with 4xx/5xx status 
codes

    ## Correctly wrap requests library Responses with 4xx/5xx status codes
    
    ### Description
    
    This fixes the constructor of `RawResponse` to explicitly check if 
`response is not None`. This is necessary because the requests library 
overloads the `__nonzero__`/`__bool__` methods on the `Response` object to 
return False if a 4xx or 5xx status code is returned. This [has been 
fixed](https://github.com/kennethreitz/requests/pull/2587) in the 3.0 branch of 
requests, but that version hasn't been released yet.
    
    ### Status
    done, ready for review
    
    ### Checklist (tick everything that applies)
    I haven't checked any of these because all I did was make a 10 character 
change.
    
    - [ ] [Code 
linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
 (required, can be done after the PR checks)
    - [ ] Documentation
    - [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
    - [ ] 
[ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
 (required for bigger changes)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/richardxia/libcloud 
LIBCLOUD-901-fix-requests-response-check

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/libcloud/pull/1006.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1006
    
----
commit 9db64851cbced4c8f8249931b619b414128373be
Author: Richard Xia <[email protected]>
Date:   2017-03-09T06:41:04Z

    [LIBCLOUD-901] Explicitly check if response is None.
    
    In versions of requests < 3.0, the __bool__/__nonzero__ method on 
RawResponse is
    overloaded to return False if the status code is 4xx or 5xx.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to