diff options
Diffstat (limited to 'worktime.py')
-rwxr-xr-x | worktime.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/worktime.py b/worktime.py index 19e2186..3f577ea 100755 --- a/worktime.py +++ b/worktime.py | |||
@@ -46,7 +46,7 @@ class TogglAPI(object): | |||
46 | def get_billable_hours(self, start_date, end_date=datetime.now(timezone.utc)): | 46 | def get_billable_hours(self, start_date, end_date=datetime.now(timezone.utc)): |
47 | url = self._make_url(api = TogglAPISection.REPORTS, section = ['summary'], params={'since': start_date.astimezone(timezone.utc).isoformat(), 'until': end_date.astimezone(timezone.utc).isoformat()}) | 47 | url = self._make_url(api = TogglAPISection.REPORTS, section = ['summary'], params={'since': start_date.astimezone(timezone.utc).isoformat(), 'until': end_date.astimezone(timezone.utc).isoformat()}) |
48 | r = self._query(url = url, method='GET') | 48 | r = self._query(url = url, method='GET') |
49 | return timedelta(milliseconds=r.json()['total_billable']) | 49 | return timedelta(milliseconds=r.json()['total_billable']) if r.json()['total_billable'] else timedelta(milliseconds=0) |
50 | 50 | ||
51 | def get_running_clock(self, now=datetime.now(timezone.utc)): | 51 | def get_running_clock(self, now=datetime.now(timezone.utc)): |
52 | url = self._make_url(api = TogglAPISection.TOGGL, section = ['time_entries', 'current']) | 52 | url = self._make_url(api = TogglAPISection.TOGGL, section = ['time_entries', 'current']) |