From 9e77f5b3465105f9e8b74577fa65a3be23b95585 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sun, 3 Sep 2023 21:29:04 +0200 Subject: [PATCH] Optimized json output --- fetch-all-data.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fetch-all-data.py b/fetch-all-data.py index c0f75a8..7088304 100644 --- a/fetch-all-data.py +++ b/fetch-all-data.py @@ -1,5 +1,6 @@ import requests import argparse +import json def create_headers(api_key): """Create headers for API requests.""" @@ -83,7 +84,7 @@ if __name__ == "__main__": if args.table_id: table_data = get_all_rows_from_table(args.base_url, args.api_key, args.table_id, args.verbose) - print(table_data) + print(json.dumps(table_data, indent=4)) else: all_data = get_all_data_from_database(args.base_url, args.api_key, args.database_id, args.verbose) - print(all_data) + print(json.dumps(all_data, indent=4)) \ No newline at end of file