aboutsummaryrefslogtreecommitdiffstats
path: root/python/ingest_file.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2019-12-18 14:53:33 -0800
committerBryan Newbold <bnewbold@archive.org>2019-12-18 14:53:35 -0800
commit1a45fe3f3ef3122355f49470fbbcd6dc82c959b2 (patch)
tree9f9e60c2814c91ad2b394c95b5ff5c9c9345d72d /python/ingest_file.py
parent0ea8bfb3485bc4db5cb7a17397d6c37f407a65b4 (diff)
downloadsandcrawler-1a45fe3f3ef3122355f49470fbbcd6dc82c959b2.tar.gz
sandcrawler-1a45fe3f3ef3122355f49470fbbcd6dc82c959b2.zip
refactor: sort keys in JSON output
This makes debugging by tailing Kafka topics a lot more readable
Diffstat (limited to 'python/ingest_file.py')
-rwxr-xr-xpython/ingest_file.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/ingest_file.py b/python/ingest_file.py
index 1980e3d..460b576 100755
--- a/python/ingest_file.py
+++ b/python/ingest_file.py
@@ -16,7 +16,7 @@ def run_single_ingest(args):
)
ingester = IngestFileWorker()
result = ingester.process(request)
- print(json.dumps(result))
+ print(json.dumps(result, sort_keys=True))
return result
def run_requests(args):
@@ -25,7 +25,7 @@ def run_requests(args):
for l in args.json_file:
request = json.loads(l.strip())
result = ingester.process(request)
- print(json.dumps(result))
+ print(json.dumps(result, sort_keys=True))
def run_api(args):
port = 8083
@@ -67,7 +67,7 @@ def main():
args = parser.parse_args()
if not args.__dict__.get("func"):
- sys.stderr.write("tell me what to do!\n")
+ print("tell me what to do!", file=sys.stderr)
sys.exit(-1)
args.func(args)