Question

I am trying to, for a login script, set a session ID using POST in python on apache. However, there doesn't appear to be any method to doing it as far as I can see other than just doing a redirect. Also, now that I have a session ID, I can use any method to set a session ID (POST seemed the most obvious). I would also like for it to work between tabs. Cookies seems like it might be a better option, though it would probably take more effort to implement. Any suggestions?

Was it helpful?

Solution

Turns out apache has a cookie module.

from mod_python import Cookie
ID = Cookie.get_cookie(req, 'ID')
if ID:
    ID.expires = time.time() + 60*120
    Cookie.add_cookie(req, ID)
    ID = ID.value
else:
    ID = None
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top