Trying to set a cookie within a python script

Νίκος nikos.the.gr33k at gmail.com
Tue Aug 3 23:08:46 EDT 2010


For the cookie problem iam tryign houts now and even this aint
working:

========================================
cookie = Cookie.SimpleCookie()

if os.environ.get('HTTP_COOKIE') and cookie.has_key('visitor') ==
'nikos':		#if visitor cookie exist
	print "Cookie Unset"
	cookie['visitor'] = 'nikos'
	cookie['visitor']['expires'] = -1		#this cookie will expire now
else:
	print "Cookie is set!"
	cookie['visitor'] = 'nikos'
	cookie['visitor']['expires'] = 1000		#this cookie will expire now
========================================

i tried in IDLE enviroment as well and for some reason even with a
single number isnated of time() function the cookie is never set,
because the print of

>>>print os.environ.get('HTTP_COOKIE')

result to

None

:(



More information about the Python-list mailing list