From e92e38bcca93f32228bb4cd1943e4e0652947326 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 4 Mar 2024 10:43:26 +0100 Subject: remove whitespace printed after every command execution The POST handling logic didn't check for empty responses before printing its contents resulting in a line of whitespace being written in the output of the program. --- cli/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/cli.py b/cli/cli.py index 81dd846..9e5ad04 100644 --- a/cli/cli.py +++ b/cli/cli.py @@ -47,7 +47,9 @@ class OgREST(): r = requests.post(f'{self.URL}{path}', headers=self.HEADERS, json=payload) - print(r.text) + if r.text: + print(r.text) + if r.status_code not in {200, 202}: sys.exit(f"Unsuccessful request to ogServer: " f"Response with {r.status_code} HTTP status code") -- cgit v1.2.3-18-g5258