From 4cb3e34b6bc0916420608f148faff9a48b7df4a2 Mon Sep 17 00:00:00 2001 From: pedro Date: Tue, 12 Nov 2024 01:15:34 +0100 Subject: [PATCH] legacy: use public_url, url is not very useful also refactor vars so it is easier to read --- workbench-script.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/workbench-script.py b/workbench-script.py index 010d593..cc85629 100644 --- a/workbench-script.py +++ b/workbench-script.py @@ -319,13 +319,15 @@ def send_snapshot_to_devicehub(snapshot, token, url, legacy): if legacy: try: response = json.loads(response_text) - if response.get('url'): + public_url = response.get('public_url') + dhid = response.get('dhid') + if public_url: # apt install qrencode - qr = "echo {} | qrencode -t ANSI".format(response['url']) + qr = "echo {} | qrencode -t ANSI".format(public_url) print(exec_cmd(qr)) - print("url: {}".format(response['url'])) - if response.get("dhid"): - print("dhid: {}".format(response['dhid'])) + print("url: {}".format(public_url)) + if dhid: + print("dhid: {}".format(dhid)) except Exception: logger.error(response_text) else: