]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-92936: update `http.cookies` docs post GH-113663 (#137566)
authorNick Burns <nburns@users.noreply.github.com>
Fri, 15 Aug 2025 20:47:46 +0000 (13:47 -0700)
committerGitHub <noreply@github.com>
Fri, 15 Aug 2025 20:47:46 +0000 (13:47 -0700)
* add versionchanged and example with quotes in cookie value

* update whatsnew with http.cookies change

* Update Doc/library/http.cookies.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Update Doc/whatsnew/3.15.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* spelling, quote

* demonstrate json

* Update Doc/library/http.cookies.rst

Co-authored-by: Senthil Kumaran <senthil@python.org>
* Apply suggestions from code review

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* shorter description

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Senthil Kumaran <senthil@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Doc/library/http.cookies.rst
Doc/whatsnew/3.15.rst

index 46efc45c5e7d96c0b7ca27491e0ffaefcd040046..9e7648ef6d83455f1615a8b18b7f52058aa166d0 100644 (file)
@@ -28,8 +28,10 @@ The character set, :data:`string.ascii_letters`, :data:`string.digits` and
 in a cookie name (as :attr:`~Morsel.key`).
 
 .. versionchanged:: 3.3
-   Allowed ':' as a valid cookie name character.
+   Allowed '``:``' as a valid cookie name character.
 
+.. versionchanged:: next
+   Allowed '``"``' as a valid cookie value character.
 
 .. note::
 
@@ -314,3 +316,10 @@ The following example demonstrates how to use the :mod:`http.cookies` module.
    >>> print(C)
    Set-Cookie: number=7
    Set-Cookie: string=seven
+   >>> import json
+   >>> C = cookies.SimpleCookie()
+   >>> C.load(f'cookies=7; mixins="{json.dumps({"chips": "dark chocolate"})}"; state=gooey')
+   >>> print(C)
+   Set-Cookie: cookies=7
+   Set-Cookie: mixins="{"chips": "dark chocolate"}"
+   Set-Cookie: state=gooey
index 6c5ab1bb1a1078bc2a30464831b21096f8129ce1..252d8966b7450fc384146ed28b635b122f81db9f 100644 (file)
@@ -267,6 +267,13 @@ http.client
   (Contributed by Alexander Enrique Urieles Nieto in :gh:`131724`.)
 
 
+http.cookies
+------------
+
+* Allow '``"``' double quotes in cookie values.
+  (Contributed by Nick Burns and Senthil Kumaran in :gh:`92936`.)
+
+
 math
 ----