diff --git a/news/11843.feature.rst b/news/11843.feature.rst new file mode 100644 index 00000000000..56ff2c6d48e --- /dev/null +++ b/news/11843.feature.rst @@ -0,0 +1 @@ +Retry on HTTP status code 502 diff --git a/src/pip/_internal/network/session.py b/src/pip/_internal/network/session.py index 887dc14e796..676e8ee723b 100644 --- a/src/pip/_internal/network/session.py +++ b/src/pip/_internal/network/session.py @@ -355,8 +355,9 @@ def __init__( # is typically considered a transient error so we'll go ahead and # retry it. # A 500 may indicate transient error in Amazon S3 + # A 502 may be a transient error from a CDN # A 520 or 527 - may indicate transient error in CloudFlare - status_forcelist=[500, 503, 520, 527], + status_forcelist=[500, 502, 503, 520, 527], # Add a small amount of back off between failed requests in # order to prevent hammering the service. backoff_factor=0.25,