Get session the expiry date (as a datetime object). Optionally, this function accepts `modification` and `expiry` keyword arguments specifying the modification and expiry of the session.
(self, **kwargs)
| 317 | return delta.days * 86400 + delta.seconds |
| 318 | |
| 319 | def get_expiry_date(self, **kwargs): |
| 320 | """Get session the expiry date (as a datetime object). |
| 321 | |
| 322 | Optionally, this function accepts `modification` and `expiry` keyword |
| 323 | arguments specifying the modification and expiry of the session. |
| 324 | """ |
| 325 | try: |
| 326 | modification = kwargs["modification"] |
| 327 | except KeyError: |
| 328 | modification = timezone.now() |
| 329 | # Same comment as in get_expiry_age |
| 330 | try: |
| 331 | expiry = kwargs["expiry"] |
| 332 | except KeyError: |
| 333 | expiry = self.get("_session_expiry") |
| 334 | |
| 335 | if isinstance(expiry, datetime): |
| 336 | return expiry |
| 337 | elif isinstance(expiry, str): |
| 338 | return datetime.fromisoformat(expiry) |
| 339 | expiry = expiry or self.get_session_cookie_age() |
| 340 | return modification + timedelta(seconds=expiry) |
| 341 | |
| 342 | async def aget_expiry_date(self, **kwargs): |
| 343 | try: |