- class Pyjo.Cookie.Response.Pyjo_Cookie_Response(morsel: Morsel[str] | None = None, *, name: str | None = None, value: str | None = None, domain: str | None = None, expires: int | float | None = None, host_only: bool | None = None, httponly: bool | None = None, max_age: int | None = None, partitioned: bool | None = None, path: str | None = None, samesite: str | None = None, secure: bool | None = None)[source]¶
Pyjo.Cookie.Responseinherits all attributes and methods fromPyjo.Cookieand implements the following new ones.- domain¶
domain = cookie.domain cookie.domain = 'localhost'
Cookie domain.
- expires¶
expires = cookie.expires cookie.expires = time.time() + 60
Expiration for cookie.
- host_only¶
boolean = cookie.host_only cookie.host_only = boolean
Host-only flag, indicating that the canonicalized request-host is identical to the cookie’s
domain.
- httponly¶
boolean = cookie.httponly cookie.httponly = boolean
HttpOnly flag, which can prevent client-side scripts from accessing this cookie.
- max_age¶
max_age = cookie.max_age cookie.max_age = 60
Max age for cookie.
- classmethod 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.SimpleCookieof the standard library.
- partitioned¶
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¶
path = cookie.path cookie.path = '/test'
Cookie path.
- samesite¶
samesite = cookie.samesite cookie.samesite = 'Lax'
SameSite value.
- secure¶
boolean = cookie.secure cookie.secure = boolean
Secure flag, which instructs browsers to only send this cookie over HTTPS connections.
- to_morsel() Morsel[str][source]¶
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, asMorselhas no such attribute there.# "foo=bar; Path=/; Secure" Pyjo.Cookie.Response.new(name='foo', value='bar', path='/', secure=True).to_morsel().OutputString()