aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-03-06 00:50:04 +0100
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-03-06 01:38:30 +0100
commited24f655243474fdef6652ea92959b13fc41c891 (patch)
tree29bda4ecf2215269b7bcae45c41aeb8b10c13628
parentMove dump to separate function (diff)
downloadtodoist-ed24f655243474fdef6652ea92959b13fc41c891.tar.xz
Dump data as JSON
pprint is not good for machine processing
-rwxr-xr-xtodoist4
1 files changed, 1 insertions, 3 deletions
diff --git a/todoist b/todoist
index 837ffb9..d028a2e 100755
--- a/todoist
+++ b/todoist
@@ -24,8 +24,6 @@ import json
import todoist
-from pprint import pprint
-
TOKEN_FILE_NAME = ".todoist_token"
DUMP_FILENAME = "dump.txt"
@@ -92,7 +90,7 @@ def store_token(token):
def dump(data):
with open(DUMP_FILENAME, mode="w") as f:
- pprint(data, f)
+ f.write(json.dumps(data, ensure_ascii=False, indent=4))
def build_project_list(data):
projects = { proj["name"].lower(): proj["id"] for proj in data["Projects"] }