Skip to content

Commit 8bd67ca

Browse files
authored
Update http.cookiejar.rst
1 parent 15c6d63 commit 8bd67ca

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Doc/library/http.cookiejar.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,20 @@ contained :class:`Cookie` objects.
247247
Note that the :meth:`save` method won't save session cookies anyway, unless you
248248
ask otherwise by passing a true *ignore_discard* argument.
249249

250+
251+
.. method:: CookieJar.clear_expired_cookies()
252+
253+
Discard all expired cookies.
254+
255+
Discards all contained cookies that have a true :attr:`is_expired` attribute
256+
(usually because their expiration time have passed)
257+
258+
You probably don't need to call this method because expired cookies are never
259+
sent back to the server (provided you're using :class:`DefaultCookiePolicy`),
260+
this method is called by :class:`CookieJar` itself every so often, and the
261+
:meth:`save` method won't save expired cookies anyway (unless you ask
262+
otherwise by passing a true *ignore_expires* argument).
263+
250264
:class:`FileCookieJar` implements the following additional methods:
251265

252266

0 commit comments

Comments
 (0)