- class watson.http.cookies.CookieDict(input=None)¶
A dictionary containing cookies.
A basic extension of the SimpleCookie class from the standard library, but designed to work better with wsgi.
cd = CookieDict() cookie = cd.add('my_cookie', 'some value') print(cookie) # my_cookie=some value print(cd['my_cookie']) # my_cookie=some value
- add(name, value='', expires=0, path='/', domain=None, secure=False, httponly=False, comment=None)¶
Convenience method to add cookies to the dict.
- 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
- comment – the associated comment with the cookie
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.
Converts a HTTP_COOKIE from an environ dict into a CookieDict.