From 663e62439c175446eea8e09f9d5ec268000d112a Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Sat, 11 Nov 2023 03:11:24 +0000 Subject: [PATCH] proper Speckle client --- main.py | 9 +++------ utils/utils_server.py | 8 ++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 7c37dd5..6060eef 100644 --- a/main.py +++ b/main.py @@ -57,12 +57,9 @@ def automate_function( """ # the context provides a conveniet way, to receive the triggering version try: - projInfo = query_version_info(automate_context) if not projInfo.speckle_type.endswith("Revit.ProjectInfo"): - automate_context.mark_run_failed( - "Not a valid 'Revit.ProjectInfo' provided" - ) + automate_context.mark_run_failed("Not a valid 'Revit.ProjectInfo' provided") lon = np.rad2deg(projInfo["longitude"]) lat = np.rad2deg(projInfo["latitude"]) @@ -88,7 +85,7 @@ def automate_function( source_data="© OpenStreetMap", source_url="https://www.openstreetmap.org/", ) - r''' + r""" roads_line_layer = Collection( elements=roads_lines, units="m", @@ -97,7 +94,7 @@ def automate_function( source_data="© OpenStreetMap", source_url="https://www.openstreetmap.org/", ) - ''' + """ roads_mesh_layer = Collection( elements=roads_meshes, units="m", diff --git a/utils/utils_server.py b/utils/utils_server.py index 2f31686..1c0061c 100644 --- a/utils/utils_server.py +++ b/utils/utils_server.py @@ -1,8 +1,7 @@ - - from specklepy.api.wrapper import StreamWrapper from gql import gql + def query_version_info(automate_context): automation_run_data = automate_context.automation_run_data # get branch name @@ -19,10 +18,7 @@ def query_version_info(automate_context): } """ ) - sw = StreamWrapper( - f"{automation_run_data.speckle_server_url}/projects/{automation_run_data.project_id}" - ) - client = sw.get_client() + client = automate_context.speckle_client params = { "project_id": automation_run_data.project_id, "model_id": automation_run_data.model_id,