Support cookies when the PoolManager or ConnectionPool is passed a CookieJar object
See original GitHub issueI think I can support cookie handling with the stdlib CookieJar object without too much trouble, and wanted to get some thoughts on implementation first.
The biggest change is that both CookieJar.extract_cookies and CookieJar.add_cookie_header both expect to work with a urllib.request.Request-like object. We can work around this by temporarily loading basic request information (essentially URL) into the appropriate object and then pull the modifications back out, but if we’re doing that, it may also be worthwhile to consider a urllib3.request.Request object that can be passed around like urllib.request.Request.
The second, more minor, change is that CookieJar.extract_cookies expects an info() method on the response which returns response headers. Given that there’s an existing urllib3 header API, for this case, I’d rather just build a disposable shim to give CookieJar what it needs.
Regardless, thoughts are appreciated on two questions: is this an appropriate feature for urllib3 to support, and if so, is using the stdlib to this extent an appropriate way to implement it?
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (10 by maintainers)

Top Related StackOverflow Question
#904 was merged, but what happened with this? It was merged into branch “sessionmanager”, but that doesn’t exist anymore. Was it dropped?
Are there any objections to upgrading the bundled
sixto the latest release?