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.
master
Alejandro Sirgo Rica 2024-03-04 10:43:26 +01:00
parent f26a8c3d23
commit e92e38bcca
1 changed files with 3 additions and 1 deletions

View File

@ -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")