Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add deprecation warnings for lastUpdateTime... #1333

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions gspread/spreadsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
SPREADSHEET_VALUES_CLEAR_URL,
SPREADSHEET_VALUES_URL,
)
from .utils import ExportFormat, finditem, quote
from .utils import ExportFormat, deprecation_warning, finditem, quote
from .worksheet import Worksheet


Expand Down Expand Up @@ -64,11 +64,9 @@ def lastUpdateTime(self):
"""Spreadsheet last updated time.
Only updated on initialisation.
For actual last updated time, use get_lastUpdateTime()."""
warnings.warn(
"""
This is only updated on initialisation and is probably outdated by the time you use it.
For an up to date last updated time, use get_lastUpdateTime().
"""
deprecation_warning(
version="6.0.0",
msg="lastUpdateTime will be removed. Please use get_lastUpdateTime()",
)
if "modifiedTime" not in self._properties:
self.update_drive_metadata()
Expand Down Expand Up @@ -759,6 +757,10 @@ def list_protected_ranges(self, sheetid):
def refresh_lastUpdateTime(self) -> None:
"""Updates the cached value of lastUpdateTime."""
# remove this and the below upon deprecation of lastUpdateTime @property
deprecation_warning(
version="6.0.0",
msg="refresh_lastUpdateTime will be removed. Please use get_lastUpdateTime()",
)
self._properties["modifiedTime"] = self.get_lastUpdateTime()

def get_lastUpdateTime(self) -> str:
Expand Down