Skip to content

Commit 9cf1c5e

Browse files
committed
Add status code 502 to the urllib retry list
fixes pypa#11843 related pypa#12008
1 parent 89950c5 commit 9cf1c5e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

news/11843.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Retry on HTTP status code 502

src/pip/_internal/network/session.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,9 @@ def __init__(
355355
# is typically considered a transient error so we'll go ahead and
356356
# retry it.
357357
# A 500 may indicate transient error in Amazon S3
358+
# A 502 may be a transient error from a CDN
358359
# A 520 or 527 - may indicate transient error in CloudFlare
359-
status_forcelist=[500, 503, 520, 527],
360+
status_forcelist=[500, 502, 503, 520, 527],
360361
# Add a small amount of back off between failed requests in
361362
# order to prevent hammering the service.
362363
backoff_factor=0.25,

0 commit comments

Comments
 (0)