diff --git a/gspread/client.py b/gspread/client.py index a419882f2..e82e5be00 100644 --- a/gspread/client.py +++ b/gspread/client.py @@ -6,6 +6,7 @@ """ +from datetime import datetime from http import HTTPStatus from typing import Any, Dict, List, Optional, Tuple, Union @@ -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: