requests icon indicating copy to clipboard operation
requests copied to clipboard

2.4.0 request refused raises different exception (breaking change)

Open thisguycodes opened this issue 12 years ago • 6 comments

(related: #2190)

in 2.3.0 the following code worked:

server_is_down = True
while server_is_down:
    try:
        requests.get(somehost)
    except requests.ConnectionError:
        sleep(0.1)
        continue
    server_is_down = False

in 2.4.0 this instead raises some urllib3 error: ProtocolError: ('Connection aborted.', error(111, 'Connection refused'))

this may just be another instance of #1572

thisguycodes avatar Sep 04 '14 19:09 thisguycodes

Why the hell isn't this wrapped? It looks like it should have raised a MaxRetryError which we'd have wrapped, but it just doesn't. Odd.

Lukasa avatar Sep 04 '14 19:09 Lukasa

@kevinburke Did retry logic change to not raise MaxRetryErrors when retries=0?

Lukasa avatar Sep 04 '14 19:09 Lukasa

@Lukasa retries=False does not raise MaxRetryErrors, not sure if the same is true for retries=0.

sigmavirus24 avatar Sep 04 '14 19:09 sigmavirus24

I'm pretty sure this is new: we used to get MaxRetryErrors in our default case. That's going to break a lot of our logic because we don't catch urllib3 HTTPErrors. We probably should treat them like MaxRetryErrors.

Lukasa avatar Sep 04 '14 19:09 Lukasa

@Lukasa I think this is fixed in #2193 since this is very related to #2192.

sigmavirus24 avatar Sep 04 '14 19:09 sigmavirus24

I actually think this is exactly fixed by #2193. =P

Lukasa avatar Sep 04 '14 19:09 Lukasa