HTTPCookie

class HTTPCookie

A cookie sent from an HTTP server to be stored on the client and returned when the path and/or domain matches.

Inheritance diagram

digraph inheritanced4d76e74b1 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "HTTPCookie" [URL="acron.core.HTTPCookie.html#acron.core.HTTPCookie",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "HTTPCookie" [arrowsize=0.75,style=""]; }
enum SameSite
enumerator SS_unspecified = 0
enumerator SS_lax = 1
enumerator SS_strict = 2
enumerator SS_none = 3
HTTPCookie.__init__()

Constructs a cookie according to the indicated string, presumably the tag of a Set-Cookie header. There is no way to detect a formatting error in the string with this constructor.

Constructs a cookie with the indicated name, path, and domain values, but no other data. This is most useful for looking up an existing cookie in the HTTPClient.

HTTPCookie.__lt__()
HTTPCookie.clear_expires()

Removes the expiration date on the cookie.

HTTPCookie.get_domain()
HTTPCookie.get_expires()

Returns the expiration date of the cookie if it is set, or an invalid date if it is not.

HTTPCookie.get_name()

Returns the name of the cookie. This is the key value specified by the server.

HTTPCookie.get_path()

Returns the prefix of the URL paths on the server for which this cookie will be sent.

HTTPCookie.get_samesite()
HTTPCookie.get_secure()

Returns true if the server has indicated this is a “secure” cookie which should only be sent over an HTTPS channel.

HTTPCookie.get_value()

Returns the value of the cookie. This is the arbitrary string associated with the cookie’s name, as specified by the server.

HTTPCookie.has_expires()

Returns true if the cookie has an expiration date, false otherwise.

HTTPCookie.is_expired()

Returns true if the cookie’s expiration date is before the indicated date, false otherwise.

HTTPCookie.matches_url()

Returns true if the cookie is appropriate to send with the indicated URL request, false otherwise.

HTTPCookie.output()
HTTPCookie.parse_set_cookie()

Separates out the parameter/value pairs of the Set-Cookie header and assigns the values of the cookie appropriate. Returns true if the header is parsed correctly, false if something is not understood.

HTTPCookie.set_domain()
HTTPCookie.set_expires()
HTTPCookie.set_name()
HTTPCookie.set_path()
HTTPCookie.set_samesite()
HTTPCookie.set_secure()
HTTPCookie.set_value()
HTTPCookie.update_from()

Assuming the operator < method, above, has already evaluated these two cookies as equal, then assign the remaining values (value, expiration date, secure flag) from the indicated cookie. This is guaranteed not to change the ordering of the cookie in a set, and so can be used to update an existing cookie within a set with new values.