legacy-mode #3

Merged
pedro merged 11 commits from legacy-mode into main 2024-10-15 12:17:26 +00:00
Showing only changes of commit fb69206f53 - Show all commits

View file

@ -302,8 +302,12 @@ def send_snapshot_to_devicehub(snapshot, token, url):
"Content-Type": "application/json" "Content-Type": "application/json"
} }
try: try:
requests.post(url, data=json.dumps(snapshot), headers=headers) response = requests.post(url, data=json.dumps(snapshot), headers=headers)
print(f"workbench: INFO: Snapshot sent to '{url}'") if response.status_code == 200:
print(f"workbench: INFO: Snapshot successfully sent to '{url}'")
else:
raise Exception(f"workbench: ERROR: Failed to send snapshot. HTTP {response.status_code}: {response.text}")
except Exception as e: except Exception as e:
print(f"workbench: ERROR: Snapshot not remotely sent. URL '{url}' is unreachable. Do you have internet? Is your server up & running?\n {e}") print(f"workbench: ERROR: Snapshot not remotely sent. URL '{url}' is unreachable. Do you have internet? Is your server up & running?\n {e}")