Networking and Internet Modules

http.cookies

Parses and serializes cookie header values through cookie containers and morsels. Morsels hold values and attributes such as Path, Secure and HttpOnly. These attributes guide browser behavior; parsing a cookie does not authenticate its contents.

Formal Syntax & Structure

python syntaxpython
import http.cookies

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from http.cookies import SimpleCookiecookies = SimpleCookie("theme=dark")print(cookies["theme"].value)
Python Reference