+ 2

How to set cookies using python scripting?

I wish to develop a web application

31st Dec 2016, 1:36 PM
jegadeesan
2 Antworten
+ 7
#!/usr/bin/env python import Cookie import datetime import random expiration = datetime.datetime.now() + datetime.timedelta(days=30) cookie = Cookie.SimpleCookie() cookie["session"] = random.randint(1000000000) cookie["session"]["domain"] = ".jayconrod.com" cookie["session"]["path"] = "/" cookie["session"]["expires"] = \ expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST") print "Content-type: text/plain" print cookie.output() print print "Cookie set with: " + cookie.output() (http://jayconrod.com/posts/17/how-to-use-http-cookies-in-python)
31st Dec 2016, 2:02 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
thank you
31st Dec 2016, 7:06 PM
jegadeesan