Documentation: Persistent cookies #2229
Unanswered
supervirus
asked this question in
General
Replies: 1 comment
-
Hi, for your code to work with the LWPCookieJar or MozillaCookieJar, you must use the previously created session to make your GET requests. from : r = httpx.get('https://httpbin.org/cookies/set?chocolate=chip') to : r = session.get('https://httpbin.org/cookies/set?chocolate=chip') |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I saw multiple questions like #895 or #1056 about persisting cookies in a file.
Maybe it would be helpful to add a small section to the documentation, as there is a quite easy way offered by Python 3 itself....
Persistent cookies can be achieved by passing an LWPCookieJar or MozillaCookieJar instance as parameter cookies to HTTPX, as it not only accepts a dict, but another CookieJar instance, as well.
Both are implementations of FileCookieJar, which offers load an save functions on top of the normal CookieJar interface.
Beta Was this translation helpful? Give feedback.
All reactions