Skip to content

Commit d86c225

Browse files
nburnspicnixzorsenthilAA-Turner
authored
gh-92936: update http.cookies docs post GH-113663 (#137566)
* 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>
1 parent 03f5519 commit d86c225

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Doc/library/http.cookies.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ The character set, :data:`string.ascii_letters`, :data:`string.digits` and
2828
in a cookie name (as :attr:`~Morsel.key`).
2929

3030
.. versionchanged:: 3.3
31-
Allowed ':' as a valid cookie name character.
31+
Allowed '``:``' as a valid cookie name character.
3232

33+
.. versionchanged:: next
34+
Allowed '``"``' as a valid cookie value character.
3335

3436
.. note::
3537

@@ -314,3 +316,10 @@ The following example demonstrates how to use the :mod:`http.cookies` module.
314316
>>> print(C)
315317
Set-Cookie: number=7
316318
Set-Cookie: string=seven
319+
>>> import json
320+
>>> C = cookies.SimpleCookie()
321+
>>> C.load(f'cookies=7; mixins="{json.dumps({"chips": "dark chocolate"})}"; state=gooey')
322+
>>> print(C)
323+
Set-Cookie: cookies=7
324+
Set-Cookie: mixins="{"chips": "dark chocolate"}"
325+
Set-Cookie: state=gooey

Doc/whatsnew/3.15.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ http.client
267267
(Contributed by Alexander Enrique Urieles Nieto in :gh:`131724`.)
268268

269269

270+
http.cookies
271+
------------
272+
273+
* Allow '``"``' double quotes in cookie values.
274+
(Contributed by Nick Burns and Senthil Kumaran in :gh:`92936`.)
275+
276+
270277
math
271278
----
272279

0 commit comments

Comments
 (0)