Skip to content

Commit

Permalink
Merge pull request #1453 from burnash/feature/expose_credentials_expiry
Browse files Browse the repository at this point in the history
Add property expiry in gspread client
  • Loading branch information
lavigne958 authored May 26, 2024
2 parents abb8b10 + c884ff6 commit 139215d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gspread/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

from datetime import datetime
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Tuple, Union

Expand Down Expand Up @@ -39,6 +40,18 @@ def __init__(
) -> None:
self.http_client = http_client(auth, session)

@property
def expiry(self) -> Optional[datetime]:
"""Returns the expiry date of the curenlty loaded credentials
:returns: (optional) datetime the expiry date time object.
.. note::
It only applies to gspread client created using oauth
"""
return self.http_client.auth.expiry

def set_timeout(
self, timeout: Optional[Union[float, Tuple[float, float]]] = None
) -> None:
Expand Down

0 comments on commit 139215d

Please sign in to comment.