You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using httpx's AsyncClient as a web spider, however I have noticed that cookies are automatically persisted and there's no easy way to disable this. My workaround has been to subclass python's http.cookiejar.CookieJar like so:
fromhttp.cookiejarimportCookieJarclassNullCookieJar(CookieJar):
"""A CookieJar that rejects all cookies."""defextract_cookies(self, *_):
"""For extracting and saving cookies. This implementation does nothing"""passdefset_cookie(self, _):
"""Normally for setting a cookie. This implementation does nothing"""pass
Would it be possible to:
add an option to disable cookie persistence to Client/AsyncClient or
include this implementation of NullCookieJar in httpx as a utility class?
Thanks!
The text was updated successfully, but these errors were encountered:
Initially raised as discussion #1533
I've been using
httpx
'sAsyncClient
as a web spider, however I have noticed that cookies are automatically persisted and there's no easy way to disable this. My workaround has been to subclass python'shttp.cookiejar.CookieJar
like so:Would it be possible to:
Client
/AsyncClient
orNullCookieJar
inhttpx
as a utility class?Thanks!
The text was updated successfully, but these errors were encountered: