From 545ea5e67adf41ff2331238ba8d71466b54902b7 Mon Sep 17 00:00:00 2001 From: Finn Gruwier Larsen Date: Wed, 15 May 2024 09:19:25 +0200 Subject: [PATCH] Show JSON responses as actual JSON --- new_project_from_files.py | 6 ++++-- new_project_from_mongo.py | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/new_project_from_files.py b/new_project_from_files.py index ae46501..9bf2adb 100644 --- a/new_project_from_files.py +++ b/new_project_from_files.py @@ -1,6 +1,7 @@ import argparse from datetime import datetime from pathlib import Path +from json import dumps import common from functions import new_project @@ -46,5 +47,6 @@ mr_base_url=common.MICROREACT_BASE_URL, verify = not args.noverify ) -print(f"REST response: {str(rest_response)}") -print(rest_response.json()) \ No newline at end of file +print(f"HTTP response code: {str(rest_response)}") +print("Response as actual JSON:") +print(dumps(rest_response.json())) \ No newline at end of file diff --git a/new_project_from_mongo.py b/new_project_from_mongo.py index b4f9d6a..dedfa21 100644 --- a/new_project_from_mongo.py +++ b/new_project_from_mongo.py @@ -1,7 +1,7 @@ import argparse from datetime import datetime from os import getenv -from sys import exit +from json import dumps from string import ascii_letters,digits from random import choice @@ -107,5 +107,6 @@ def random_string(n): mr_base_url=common.MICROREACT_BASE_URL, verify = not args.noverify ) -print(f"REST response: {str(rest_response)}") -print(rest_response.json()) \ No newline at end of file +print(f"HTTP response code: {str(rest_response)}") +print("Response as actual JSON:") +print(dumps(rest_response.json())) \ No newline at end of file