#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    india
    Posts
    2
    Rep Power
    0

    Question python and cookie


    hi
    how i can set life time of a cookie using python .i want to reset(destroy) the cookie when the interaction is idle for a time or when logout from the site ..can u help me?
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,592
    Rep Power
    4207
    Set the expires value:
    Code:
    import Cookie
    
    C = Cookie.SimpleCookie()
    C["cookie_name"] = "cookie_value"
    # Set cookie expiration time to 1 hour (3600 seconds)
    C["cookie_name"]["expires"] = 3600
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo