简体   繁体   中英

How to set timeout for TWISTED_SESSION cookie

When I run python Twisted server, there is a default cookie TWISTED_SESSION. However I don't know how to set cookie timeout for it. https://twistedmatrix.com does not provide any info about that.

You can set the Session.sessionTimeout attribute to control this.

from twisted.server.site import Session, Site

def longTimeoutSession(*args, **kwargs):
    session = Session(*args, **kwargs)
    session.sessionTimeout = 1234
    return session

site = Site(...)
site.sessionFactory = longTimeoutSession

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM