From 8bd67cad32dc1fa890996bcb90ee0064e09838b9 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Tue, 24 Jun 2025 18:33:34 +0800 Subject: [PATCH 1/9] Update http.cookiejar.rst --- Doc/library/http.cookiejar.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index 23ddecf873876d..d76cf163b8eb9a 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -247,6 +247,20 @@ contained :class:`Cookie` objects. Note that the :meth:`save` method won't save session cookies anyway, unless you ask otherwise by passing a true *ignore_discard* argument. + +.. method:: CookieJar.clear_expired_cookies() + + Discard all expired cookies. + + Discards all contained cookies that have a true :attr:`is_expired` attribute + (usually because their expiration time have passed) + + You probably don't need to call this method because expired cookies are never + sent back to the server (provided you're using :class:`DefaultCookiePolicy`), + this method is called by :class:`CookieJar` itself every so often, and the + :meth:`save` method won't save expired cookies anyway (unless you ask + otherwise by passing a true *ignore_expires* argument). + :class:`FileCookieJar` implements the following additional methods: From 7fde817f660efede9b1d7934b4f54152b16fc8d8 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:28:02 +0800 Subject: [PATCH 2/9] Update http.cookiejar.rst --- Doc/library/http.cookiejar.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index d76cf163b8eb9a..7ac0724ac7f9c0 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -252,13 +252,16 @@ contained :class:`Cookie` objects. Discard all expired cookies. - Discards all contained cookies that have a true :attr:`is_expired` attribute + Discards all contained cookies that have a true :attr:`expires` attribute (usually because their expiration time have passed) You probably don't need to call this method because expired cookies are never - sent back to the server (provided you're using :class:`DefaultCookiePolicy`), - this method is called by :class:`CookieJar` itself every so often, and the - :meth:`save` method won't save expired cookies anyway (unless you ask + sent back to the server (provided you're using :class:`DefaultCookiePolicy`). + This method is called by :class:`CookieJar` itself every so often. It *could* + only be useful when you are customizing a `CookiePolicy` with your own + expiring logic. + + Note that the :meth:`save` method won't save expired cookies anyway (unless you ask otherwise by passing a true *ignore_expires* argument). :class:`FileCookieJar` implements the following additional methods: From a0b192d7e046330bc4860abc74cad0ba07ae9d8e Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:30:55 +0800 Subject: [PATCH 3/9] Update http.cookiejar.rst --- Doc/library/http.cookiejar.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index 7ac0724ac7f9c0..90d67e5966a5fa 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -258,7 +258,7 @@ contained :class:`Cookie` objects. You probably don't need to call this method because expired cookies are never sent back to the server (provided you're using :class:`DefaultCookiePolicy`). This method is called by :class:`CookieJar` itself every so often. It *could* - only be useful when you are customizing a `CookiePolicy` with your own + only be useful when you are customizing a `CookiePolicy` with your own expiring logic. Note that the :meth:`save` method won't save expired cookies anyway (unless you ask From da10c7b839d1e4e95209787c8a89d232ca8ee2c7 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:32:38 +0800 Subject: [PATCH 4/9] Update http.cookiejar.rst --- Doc/library/http.cookiejar.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index 90d67e5966a5fa..54b4b1b70d7a02 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -258,7 +258,7 @@ contained :class:`Cookie` objects. You probably don't need to call this method because expired cookies are never sent back to the server (provided you're using :class:`DefaultCookiePolicy`). This method is called by :class:`CookieJar` itself every so often. It *could* - only be useful when you are customizing a `CookiePolicy` with your own + only be useful when you are customizing a :class:`CookiePolicy` with your own expiring logic. Note that the :meth:`save` method won't save expired cookies anyway (unless you ask From 8ee9c8bba6c649a8580c83ebdab05f630116ce69 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:39:04 +0800 Subject: [PATCH 5/9] Update http.cookiejar.rst --- Doc/library/http.cookiejar.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index 54b4b1b70d7a02..74dbdf48d81aa1 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -255,11 +255,11 @@ contained :class:`Cookie` objects. Discards all contained cookies that have a true :attr:`expires` attribute (usually because their expiration time have passed) - You probably don't need to call this method because expired cookies are never - sent back to the server (provided you're using :class:`DefaultCookiePolicy`). - This method is called by :class:`CookieJar` itself every so often. It *could* - only be useful when you are customizing a :class:`CookiePolicy` with your own - expiring logic. + This is a low-level function which probably don't need to be called because + expired cookies are never sent back to the server (provided using + :class:`DefaultCookiePolicy`). This method is called by :class:`CookieJar` + itself every so often. It *could* only be useful when customizing a + :class:`CookiePolicy` with an expiring logic. Note that the :meth:`save` method won't save expired cookies anyway (unless you ask otherwise by passing a true *ignore_expires* argument). From d212a853ecfbcbb515db33d094b046071bb5a73a Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:41:31 +0800 Subject: [PATCH 6/9] Update http.cookiejar.rst --- Doc/library/http.cookiejar.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index 74dbdf48d81aa1..cd6577ed292c5c 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -261,8 +261,8 @@ contained :class:`Cookie` objects. itself every so often. It *could* only be useful when customizing a :class:`CookiePolicy` with an expiring logic. - Note that the :meth:`save` method won't save expired cookies anyway (unless you ask - otherwise by passing a true *ignore_expires* argument). + Note that the :meth:`save` method won't save expired cookies anyway (unless you + ask otherwise by passing a true *ignore_expires* argument). :class:`FileCookieJar` implements the following additional methods: From 58230dc0c3aae2731f073609016735354ecc2771 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Sat, 2 Aug 2025 19:51:35 +0800 Subject: [PATCH 7/9] remove the following paragraph MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Doc/library/http.cookiejar.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index cd6577ed292c5c..c2063f9155ea91 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -255,11 +255,14 @@ contained :class:`Cookie` objects. Discards all contained cookies that have a true :attr:`expires` attribute (usually because their expiration time have passed) - This is a low-level function which probably don't need to be called because - expired cookies are never sent back to the server (provided using - :class:`DefaultCookiePolicy`). This method is called by :class:`CookieJar` - itself every so often. It *could* only be useful when customizing a - :class:`CookiePolicy` with an expiring logic. + This is a low-level function which usually does not need to be called + since expired cookies are never sent back to the server when using + :class:`DefaultCookiePolicy` nor are they saved by :meth:`save` unless + the latter is called with a truthy *ignore_expires*. + + Since :class:`CookieJar` also calls this method every so often, + it *could* only be useful when customizing a :class:`CookiePolicy` + with an expiring logic. Note that the :meth:`save` method won't save expired cookies anyway (unless you ask otherwise by passing a true *ignore_expires* argument). From cf78c640c02eeee71581fa1636b9a0f1c6b047b3 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Sat, 2 Aug 2025 23:43:28 +0800 Subject: [PATCH 8/9] remove the save para --- Doc/library/http.cookiejar.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index c2063f9155ea91..9128ac4a410738 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -264,8 +264,6 @@ contained :class:`Cookie` objects. it *could* only be useful when customizing a :class:`CookiePolicy` with an expiring logic. - Note that the :meth:`save` method won't save expired cookies anyway (unless you - ask otherwise by passing a true *ignore_expires* argument). :class:`FileCookieJar` implements the following additional methods: From cbee7627104b88233f7e965730a2136eac9789b0 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Sun, 3 Aug 2025 20:15:47 +0800 Subject: [PATCH 9/9] Update Doc/library/http.cookiejar.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Doc/library/http.cookiejar.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index 9128ac4a410738..7a64deead92f00 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -252,8 +252,7 @@ contained :class:`Cookie` objects. Discard all expired cookies. - Discards all contained cookies that have a true :attr:`expires` attribute - (usually because their expiration time have passed) + Discards all contained cookies that have a true :attr:`expires` attribute. This is a low-level function which usually does not need to be called since expired cookies are never sent back to the server when using