Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
Checks that list response contains values
Browse files Browse the repository at this point in the history
Bug: 70534103
Change-Id: Iaae903556d197cb62cefa8f7b480857463efac05
  • Loading branch information
Fleker committed Dec 12, 2017
1 parent 41a6cea commit 3609f86
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions google-assistant-sdk/googlesamples/assistant/grpc/devicetool.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,17 @@ def list(ctx, resource):
response = json.loads(r.text)
logging.debug(r.text)
if resource == 'deviceModels':
for devicemodel in response['deviceModels']:
pretty_print_model(devicemodel)
if 'deviceModels' in response:
for devicemodel in response['deviceModels']:
pretty_print_model(devicemodel)
else:
logging.info('No device models found')
elif resource == 'devices':
for device in response['devices']:
pretty_print_device(device)
if 'devices' in response:
for device in response['devices']:
pretty_print_device(device)
else:
logging.info('No devices found')


def main():
Expand Down

0 comments on commit 3609f86

Please sign in to comment.