Cookie.parse

Parses header and returns a #SoupCookie.

If header contains multiple cookies, only the first one will be parsed.

If header does not have "path" or "domain" attributes, they will be defaulted from origin. If origin is null, path will default to "/", but domain will be left as null. Note that this is not a valid state for a #SoupCookie, and you will need to fill in some appropriate string for the domain if you want to actually make use of the cookie.

As of version 3.4.0 the default value of a cookie's same-site-policy is soup.types.SameSitePolicy.Lax.

class Cookie
static
parse
(
string header
,)

Parameters

header string

a cookie string (eg, the value of a Set-Cookie header)

origin glib.uri.Uri

origin of the cookie

Return Value

Type: soup.cookie.Cookie

a new #SoupCookie, or null if it could not be parsed, or contained an illegal "domain" attribute for a cookie originating from origin.