I’m using Google App Engine. How do I set either multiple cookies or a multi-value cookie with a single response?
Right now I’m using this code from the URL http://localhost:8085/server/showcookie?emailAddress=myemail@gmail.com&secretCode=1
C = Cookie.SimpleCookie()
C["emailAddress"] = self.request.get('emailAddress')
C["secretCode"] = self.request.get('secretCode')
C["secretCode"]["path"] = "/"
header_value = C.output(header='')
self.response.headers.add_header("Set-Cookie", header_value)
which doesn’t work because the value of header_value is emailAddress=”myemail@gmail.com” secretCode=1; Path=/ which is not a well formed header (its missing a comma). How can I create a well formed cookie with both values?
Using two SimpleCookie objects solves it: