I am trying to write a script in python which uses the Cookie library to set cookies. I have written the following method:
import uuid
import Cookie
import sys
import os
def send_cookie(key, value, max_age):
cookie = Cookie.SimpleCookie()
cookie[key]=value
cookie[key]['max-age']=max_age
print cookie.output()
The problem is when I call this method multiple times for example, send_cookie('foo',123,1000), send_cookie('foo2',12345,1000). I would 'assume' that these cookies are stored onto my computer. When I print the os.environ['HTTP_COOKIE'], I dont't see any of the cookies I set in there.