-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Subject
This started happening with the 2.5.0 release, as a result of changes made in f05b132. If you create a PoolManager with an explicit number of retries given as an integer, then redirects get disabled. I believe this is not intended.
Environment
Describe your environment.
OS macOS-15.5-arm64-arm-64bit
Python 3.11.10
OpenSSL 3.5.0 8 Apr 2025
urllib3 2.5.0
Steps to Reproduce
Run the following in a Python repl:
import urllib3
http = urllib3.PoolManager(retries=10)
r = http.request("GET", "https://httpbin.org/redirect/1")Expected Behavior
A response is returned.
Actual Behavior
The request raises the following exception:
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='httpbin.org', port=443): Max retries exceeded with url: https://httpbin.org/redirect/1 (Caused by ResponseError('too many redirects'))
Additional details
The error only occurs when the pool is initialized with an integer number of retries. Both not passing retries and passing it set to a Retry instance leave redirects enabled and working as expected. Adding a retries argument to the request() call also works fine, even if an integer is passed as its value.
Metadata
Metadata
Assignees
Labels
No labels