Skip to content

Commit e61a08d

Browse files
authored
Merge pull request planetlabs#201 from planetlabs/ak_debug_subscription_list
Response sometimes can print twice
2 parents 1a6c0d3 + d59f4d9 commit e61a08d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

planet/scripts/util.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,16 @@ def echo_json_response(response, pretty, limit=None, ndjson=False):
178178
elif not ndjson and hasattr(response, 'json_encode'):
179179
response.json_encode(click.get_text_stream('stdout'), limit=limit,
180180
indent=indent, sort_keys=sort_keys)
181-
182-
res = response.get_raw()
183-
if len(res) == 0: # if the body is empty, just return the status
184-
click.echo("status: {}".format(response.response.status_code))
185181
else:
186-
res = json.dumps(json.loads(res), indent=indent,
187-
sort_keys=sort_keys)
188-
click.echo(res)
189-
if nl:
190-
click.echo()
182+
res = response.get_raw()
183+
if len(res) == 0: # if the body is empty, just return the status
184+
click.echo("status: {}".format(response.response.status_code))
185+
else:
186+
res = json.dumps(json.loads(res), indent=indent,
187+
sort_keys=sort_keys)
188+
click.echo(res)
189+
if nl:
190+
click.echo()
191191
except IOError as ioe:
192192
# hide scary looking broken pipe stack traces
193193
raise click.ClickException(str(ioe))

0 commit comments

Comments
 (0)