|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Rietrieving cookies help again
This is an example script that sets a cookie, i made it up real fast so it might have a slight error in it somewhere.
import Cookie import id id = id.generateid() IFcookie = Cookie.SimpleCookie() IFcookie['id'] = id IFcookie['usrname'] = 'conrad' print IFcookie print 'Content-type: text/html\n' print 'cookie set' This is where i run into problems this is the code i use to retrieve these cookies: #!/usr/bin/python import cgitb import Cookie import os cgitb.enable() value = os.environ['id'] print "Content-type: text/html\n" print value It says its a Key Error and that 'mapping key cannot be found' it points the error at this statement: value = os.environ['id'] the error message says that it cannot find id even though i check my cookie list in mozilla and see that its there. Any help would be appreciated. BTW this is the last peice I need to implement before i put an alpha vrsion of my forums up. Next I'll need to rewrite them into oop before beta and release. |
|
#2
|
||||
|
||||
|
You want to look in os.environ['HTTP_COOKIE'], this will return a string which you'll need to parse if you wana use it! But why not just use load()?
Mark. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Rietrieving cookies help again |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|