Skip to content

Commit 028779d

Browse files
authored
Merge pull request #10 from swappsco/migrate-to-toggl-v9
migrate-to-toggl-v9
2 parents 7adda39 + 5d78a26 commit 028779d

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ Download to a location of your choice and do the following.
2424
from toggl.api_client import TogglClientApi
2525

2626
settings = {
27-
'token': 'xxx',
28-
'user_agent': 'your app name'
27+
'token': 'token',
28+
'user_agent': 'agent',
29+
'workspace_id': '####',
30+
'username': 'email',
2931
}
30-
toggle_client = TogglClientApi(settings)
32+
toggl_client = TogglClientApi(settings)
3133

32-
response = toggle_client.get_workspaces()
34+
response = toggl_client.get_workspaces()
3335

3436
```
3537

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def readme():
88

99
setup(
1010
name="python-toggl",
11-
version="0.1.12",
11+
version="0.2.0",
1212
description="Python Wrapper for Toggl API",
1313
long_description=readme(),
1414
url="https://github.com/swappsco/toggl-python-api-client",

tests/tests_live.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_api_client_instance_created(self):
2323
self.assertNotEqual(self.api, None)
2424

2525
def test_valid_toggl_base_url(self):
26-
self.assertEqual(self.api.api_base_url, "https://api.track.toggl.com/api/v8")
26+
self.assertEqual(self.api.api_base_url, "https://api.track.toggl.com/api/v9")
2727

2828
def test_api_toggl_auth_check_response_ok(self):
2929
response = self.api.query("/me")

toggl/api_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class TogglClientApi(object):
77
"username": "",
88
"workspace_name": "",
99
"base_url": "https://api.track.toggl.com/api",
10-
"ver_api": 8,
10+
"ver_api": 9,
1111
"base_url_report": "https://api.track.toggl.com/reports/api",
1212
"ver_report": 2,
1313
}
@@ -56,11 +56,11 @@ def get_workspace_by_name(self, name):
5656
def get_workspaces(self):
5757
return self.query("/workspaces")
5858

59-
def get_projects(self):
60-
return self.query("/workspaces/%i/projects" % self.workspace_id)
59+
def get_projects(self, active=True):
60+
return self.query("/workspaces/%i/projects" % self.workspace_id, params={"active": active})
6161

6262
def get_workspace_members(self, workspace_id):
63-
response = self.query("/workspaces/" + str(workspace_id) + "/workspace_users")
63+
response = self.query("/workspaces/" + str(workspace_id) + "/users")
6464
return response
6565

6666
"""
@@ -120,7 +120,7 @@ def get_project_times(self, project_id, start_date, end_date, extra_params={}):
120120
return json_response
121121

122122
def get_dashboard_data(self, params={}):
123-
dashboard_response = self.query("/dashboard/%i" % self.workspace_id, params)
123+
dashboard_response = self.query("/workspaces/%i/dashboard/all_activity" % self.workspace_id, params)
124124

125125
if dashboard_response.status_code != requests.codes.ok:
126126
dashboard_response.raise_for_status()
@@ -144,7 +144,7 @@ def create_time_entry(self, json_data):
144144
}
145145
}
146146
"""
147-
response = self.query("/time_entries", method="POST", json_data=json_data)
147+
response = self.query("/workspaces/%i/time_entries" % self.workspace_id, method="POST", json_data=json_data)
148148

149149
if response.status_code != requests.codes.ok:
150150
response.raise_for_status()

0 commit comments

Comments
 (0)