Pyjo.Cookie.Response inherits all attributes and methods from Pyjo.Cookie and implements the following new ones.

domain = cookie.domain
cookie.domain = 'localhost'

Cookie domain.

expires = cookie.expires
cookie.expires = time.time() + 60

Expiration for cookie.

boolean = cookie.host_only
cookie.host_only = boolean

Host-only flag, indicating that the canonicalized request-host is identical to the cookie’s domain.

boolean = cookie.httponly
cookie.httponly = boolean

HttpOnly flag, which can prevent client-side scripts from accessing this cookie.

max_age = cookie.max_age
cookie.max_age = 60

Max age for cookie.

cookies = Pyjo.Cookie.Response.parse('f=b; path=/')
cookies = Pyjo.Cookie.Response.parse(SimpleCookie('f=b; path=/'))

Parse cookies, also from a http.cookies.SimpleCookie of the standard library.

partitioned = cookie.partitioned
cookie.partitioned = True

Partitioned flag, this is to be used in accordance to the CHIPS amendment to RFC 6265. Note that this attribute is EXPERIMENTAL because even though most commonly used browsers support the feature, there is no specification yet besides this draft.

path = cookie.path
cookie.path = '/test'

Cookie path.

samesite = cookie.samesite
cookie.samesite = 'Lax'

SameSite value.

boolean = cookie.secure
cookie.secure = boolean

Secure flag, which instructs browsers to only send this cookie over HTTPS connections.

morsel = cookie.to_morsel()

Turn cookie into a http.cookies.Morsel, for the standard library. The partitioned flag is left out before Python 3.14, as Morsel has no such attribute there.

# "foo=bar; Path=/; Secure"
Pyjo.Cookie.Response.new(name='foo', value='bar', path='/', secure=True).to_morsel().OutputString()
string = cookie.to_str()

Render cookie.

Pyjo.Cookie.Response.parse(string: str | BaseCookie[str] | None = None) → list[C][source]
cookies = Pyjo.Cookie.Response.parse('f=b; path=/')
cookies = Pyjo.Cookie.Response.parse(SimpleCookie('f=b; path=/'))

Parse cookies, also from a http.cookies.SimpleCookie of the standard library.