• alex-dr's avatar
    Fix APIError status_code property for client/server errors · bbad864d
    alex-dr yazdı
    requests.Response objects evaluate as falsy when the status_code
    attribute is in the 400-500 range. Therefore we are assured that
    prior to this change, APIError would show `is_server_error() == False`
    when generated with a 500-level response and `is_client_error() == False`
    when generated with a 400-level response. This is not desirable.
    
    Added some seemingly dry (not DRY) unit tests to ensure nothing silly
    slips back in here.
    Signed-off-by: 's avataralex-dr <alex@datarobot.com>
    bbad864d
errors_test.py 3.02 KB