From c2986865cdac50ae7d6d643c7c6b9e99a1692ff9 Mon Sep 17 00:00:00 2001 From: Marty Vowles Date: Mon, 23 Nov 2020 15:35:02 -0700 Subject: [PATCH 1/4] Addressing timesheet_deleteds bug When using the API to query timesheets_deleted, line 11 causes a problem where the query looks for timesheet_deleteds. This special cases for that class, though I'm a python amateur and there may be a cleaner way to do that. --- tsheets/results.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tsheets/results.py b/tsheets/results.py index 91dd896..769c1f1 100644 --- a/tsheets/results.py +++ b/tsheets/results.py @@ -9,6 +9,8 @@ def __init__(self, url, options, repo, bridge, is_singleton=False, mode="list"): self.repo = repo self.model = repo.model self.name = class_to_endpoint(self.model.__name__) + ('' if is_singleton else 's') + if isinstance(self.repo, repos.TimesheetsDeleted): + self.name = 'timesheets_deleted' self.index = -1 self.loaded = [] self.bridge = bridge From e58f50a4a5186db7ff18caac8ddfbdbd3fb1c43c Mon Sep 17 00:00:00 2001 From: Marty Vowles Date: Tue, 24 Nov 2020 14:52:10 -0700 Subject: [PATCH 2/4] Fixing API to work with changed JSON return Looks like some time recently the JSON data returned changed from a string 'true' to the value True. This will allow the wrapper to pull more than the first page of records again. --- tsheets/bridge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsheets/bridge.py b/tsheets/bridge.py index 8cf8c7e..fcc1f47 100644 --- a/tsheets/bridge.py +++ b/tsheets/bridge.py @@ -40,7 +40,7 @@ def next_batch(self, url, name, options, is_singleton = False, mode="list"): s_dict[key] = list(value.values()) has_more = data.get('more', None) result = {"items": self.items_from_data(data, name, is_singleton, mode), - "has_more": (has_more == 'true'), + "has_more": (has_more == True), "supplemental": s_dict} return result else: From 9b90d4f67a18d2bcad0551309d0d211b2384867a Mon Sep 17 00:00:00 2001 From: Marty Vowles Date: Fri, 19 Feb 2021 16:15:21 -0700 Subject: [PATCH 3/4] Expanding library ranges. --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 884f5f2..5f6e44b 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ keywords=['api', 'rest', 'tsheets'], install_requires=[ 'requests>=2.7.0', - 'python-dateutil==2.4.2', - 'pytz==2015.7' + 'python-dateutil>=2.4.2', + 'pytz>=2015.7' ] ) From 993600f118b0950c6a5cebbb3ab6a65c894d33d1 Mon Sep 17 00:00:00 2001 From: Marty Vowles Date: Fri, 19 Feb 2021 16:25:41 -0700 Subject: [PATCH 4/4] Fiddling with numbers --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5f6e44b..c108fe1 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ keywords=['api', 'rest', 'tsheets'], install_requires=[ 'requests>=2.7.0', - 'python-dateutil>=2.4.2', + 'python-dateutil==2.8.1', 'pytz>=2015.7' ] )