watson.http.cookies¶
A dictionary containing cookies.
A basic extension of the SimpleCookie class from the standard library, but designed to work better with wsgi.
Example:
cd = CookieDict() cookie = cd.add('my_cookie', 'some value') print(cookie) # my_cookie=some value print(cd['my_cookie']) # my_cookie=some value
Convenience method to add cookies to the dict.
Parameters: - name – the name of the cookie
- value – the value of the cookie
- expires – the expiration date for the cookie in seconds
- path – the path in which the cookie is valid
- domain – the domain in which the cookie is valid
- secure – only send cookies over https
- httponly – only send over http requests, not accessible via JavaScript
- comment – the associated comment with the cookie
Returns: The morsel that was added to the CookieDict
Expire a cookie the next time it is sent to the browser.
Parameters: name – the name of the cookie
Expire all the cookies in the dictionary.
Merges an existing cookie dict into another cookie dict.
Parameters: cookie_dict (CookieDict) – The cookie dict to merge
Converts a HTTP_COOKIE from an environ dict into a CookieDict.