Currently Response.set_cookie will accept a datetime instance to specify the time at which the cookie should expire.
However, this datetime instance is expected to be a utc datetime, for example datetime.utcnow() + timedelta(seconds=3600), not a local datetime like datetime.now() + timedelta(seconds=3600).
Also, the provided datetime instance must NOT be timezone-aware or you will get an error. For example passing datetime.utcnow(tz=pytz.utc) + timedelta(seconds=3600).
If callers are not aware of these requirements, their application might fail unexpectedly if the app moves between time zones.
Currently
Response.set_cookiewill accept adatetimeinstance to specify the time at which the cookie should expire.However, this
datetimeinstance is expected to be autcdatetime, for exampledatetime.utcnow() + timedelta(seconds=3600), not a local datetime likedatetime.now() + timedelta(seconds=3600).Also, the provided
datetimeinstance must NOT be timezone-aware or you will get an error. For example passingdatetime.utcnow(tz=pytz.utc) + timedelta(seconds=3600).If callers are not aware of these requirements, their application might fail unexpectedly if the app moves between time zones.