Replies: 1 comment 2 replies
-
Interesting question. There's not much out there on Python's cookie policy API, so I'd like to start by understanding your use case more thoroughly first... what is the alternate policy that you'd actually like to set, and how does it differ from the default? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to be able to override the cookie policy used by a Client when making a request. However, overriding the cookie policy on the cookie jar of the Client or of the Request object has had no effect. These lines of code explains why:
httpx/httpx/_models.py
Line 334 in 497b315
httpx/httpx/_models.py
Line 1030 in 497b315
When initialise request from existing cookies (which is Cookies object of Client), it discards policy object from source Cookies object.
httpx/httpx/_client.py
Line 400 in 497b315
The cookie jars of both the client and the request are merged into a newly constructed CookieJar, discarding the policies of both.
What I expected to be able to do, and what isn't working currently, is something like the following:
In my opinion Policy from CookieJar in Client should not be discarded. When CookieJar object passed in request then policy from request should override policy from Client.
Beta Was this translation helpful? Give feedback.
All reactions