question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support cookies when the PoolManager or ConnectionPool is passed a CookieJar object

See original GitHub issue

I 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:open
  • Created 7 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Foorackcommented, Aug 30, 2021

#904 was merged, but what happened with this? It was merged into branch “sessionmanager”, but that doesn’t exist anymore. Was it dropped?

1reaction
haikugingercommented, Apr 14, 2016

Are there any objections to upgrading the bundled six to the latest release?

Read more comments on GitHub >

github_iconTop Results From Across the Web

http.cookiejar — Cookie handling for HTTP clients — Python ...
policy is an object implementing the CookiePolicy interface. The CookieJar class stores HTTP cookies. It extracts cookies from HTTP requests, and returns them ......
Read more >
Python urllib3 and how to handle cookie support?
One thing to keep in mind, urllib3's HTTPConnectionPool is intended to be a "pool of connections" to a specific host, as opposed to...
Read more >
Class: ActionDispatch::Cookies::CookieJar — Rails 7-0-stable
Returns a new ::Array where the order has been set to that provided in the series , based on the key of the...
Read more >
Developer Interface — Requests 2.28.1 documentation
cookies – (optional) Dict or CookieJar object to send with the Request . files – (optional) Dictionary of 'name': file-like-objects (or {'name': file-tuple}...
Read more >
Community Updates — Requests 2.18.1 documentation
The verify keyword argument now supports being passed a path to a ... This method updates a Request object with the data (e.g....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found