Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ docs/_build/
# PyBuilder
target/

# JetBrains
.idea/

# Jupyter Notebook
.ipynb_checkpoints

Expand Down Expand Up @@ -122,6 +125,7 @@ dmypy.json
# Pyre type checker
.pyre/

*.json
# Project filex
config.json
log.txt
/.vs/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Migrate data from toggl to clockify
Migration consists of six steps (which are described in detail below):
1. Prepare clockify workspace
2. Prepare Toggl workspace
3. Modify **config.json**
3. Copy **config.sample.json** to **config.json** and modify it
4. Run the migration tool **bin/toggl2clockify.exe** (or **python toggl2clockify.py** on other platforms)
5. After the import go through **log.txt** and search for "WARNING" entries (if you're unsure post a bug report)
6. Finalize migration (archive projects in clockify which were archived on toggl) by running **bin/toggl2clockify.exe --skipClients --skipProjects --skipEntries --skipTags --doArchive**
Expand Down
2 changes: 1 addition & 1 deletion config.json → config.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"ClockifyKeys": ["XP09NRCA7GYGEml5"],
"StartTime": "2017-04-15",
"ClockifyAdmin": "mproeller@googlemail.com"
}
}
14 changes: 7 additions & 7 deletions converter/clockify/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, api_tokens, admin_email="", fallback_email=None):

projects_url = self.base_url + "/workspaces/%s/projects"
users_url = self.base_url + "/workspace/%s/users"
usergroups_url = self.base_url + "/workspaces/%/userGroups"
usergroups_url = self.base_url + "/workspaces/%s/user-groups"
tags_url = self.base_url + "/workspaces/%s/tags"
clients_url = self.base_url + "/workspaces/%s/clients"

Expand Down Expand Up @@ -368,12 +368,12 @@ def get_project_users(self, workspace_id, project_id):
Returns list of users in project
"""
user_ids = []
url = self.base_url + "/workspaces/%s/projects/%s/users" % (
workspace_id,
project_id,
url = self.base_url + "/workspaces/%s/users" % (
workspace_id
)

retval = self.request(url, self.admin_email, typ="GET")
payload = {project_id: project_id}
retval = self.request(url, self.admin_email, body=payload, typ="GET")
user_ids = retval.json()
self.logger.info("Finished getting users already assigned to the project.")

Expand Down Expand Up @@ -481,7 +481,7 @@ def add_groups_to_project(self, proj):
for user in proj_users:
user_ids.append(user["id"])

for group_name in proj.proj_groups:
for group_name in proj.groups:
group_id = self.get_usergroup_id(group_name, proj.workspace)
user_group_ids.append(group_id)

Expand Down Expand Up @@ -517,7 +517,7 @@ def add_usergroup(self, group_name, workspace):
"""

ws_id = self.get_workspace_id(workspace)
url = self.base_url + "/workspaces/%s/userGroups/" % ws_id
url = self.base_url + "/workspaces/%s/user-groups/" % ws_id
params = {"name": group_name}
retval = self.request(url, self.admin_email, body=params, typ="POST")
if retval.status_code == 201:
Expand Down
2 changes: 1 addition & 1 deletion converter/clockify/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def set_memberships(self, toggl_api):
for member in t_members:
# grab email of user
try:
email = self.get_toggl_email(member["uid"], toggl_api)
email = self.get_toggl_email(toggl_api, member["uid"])
except RuntimeError:
return True

Expand Down
2 changes: 1 addition & 1 deletion converter/toggl_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def _get_reports(self, workspace_name, since, until, callback):
"page": page,
}

report_url = "https://toggl.com/reports/api/v2/details"
report_url = "https://api.track.toggl.com/reports/api/v2/details"
response = self._request(report_url, params=params)
if response.status_code == 400:
break
Expand Down