parse snapshot as dict

This commit is contained in:
Thomas Nahuel Rusiecki 2024-11-20 01:15:31 -03:00
parent ae5f9c341a
commit edc8ab6d3a
1 changed files with 4 additions and 0 deletions

4
workbench-script.py Normal file → Executable file
View File

@ -309,6 +309,10 @@ def save_snapshot_in_disk(snapshot, path, snap_uuid):
# url = 'http://127.0.0.1:8000/api/snapshot/' # url = 'http://127.0.0.1:8000/api/snapshot/'
def send_snapshot_to_devicehub(snapshot, token, url): def send_snapshot_to_devicehub(snapshot, token, url):
url_components = urllib.parse.urlparse(url) url_components = urllib.parse.urlparse(url)
if isinstance(snapshot, str):
snapshot = json.loads(snapshot)
ev_path = "evidence/{}".format(snapshot["uuid"]) ev_path = "evidence/{}".format(snapshot["uuid"])
components = (url_components.schema, url_components.netloc, ev_path, '', '', '') components = (url_components.schema, url_components.netloc, ev_path, '', '', '')
ev_url = urllib.parse.urlunparse(components) ev_url = urllib.parse.urlunparse(components)