From cc1f9ef464d8a59eb8f2b0cdbc269ea224e141bb Mon Sep 17 00:00:00 2001 From: Chuong Ho Date: Wed, 4 Sep 2024 08:43:44 +0800 Subject: [PATCH] fix issue get urn empty --- APSToolkitPython/setup.py | 2 +- APSToolkitPython/src/aps_toolkit/AECDataModel.py | 1 - APSToolkitPython/src/aps_toolkit/BIM360.py | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/APSToolkitPython/setup.py b/APSToolkitPython/setup.py index 44a6928..92a256a 100644 --- a/APSToolkitPython/setup.py +++ b/APSToolkitPython/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name="aps-toolkit", - version="0.9.8", + version="0.9.9", author="chuong mep", author_email="chuongpqvn@gmail.com", description="A Toolkit Autodesk Platform Services for Python", diff --git a/APSToolkitPython/src/aps_toolkit/AECDataModel.py b/APSToolkitPython/src/aps_toolkit/AECDataModel.py index 74e6c36..fc766c1 100644 --- a/APSToolkitPython/src/aps_toolkit/AECDataModel.py +++ b/APSToolkitPython/src/aps_toolkit/AECDataModel.py @@ -23,7 +23,6 @@ def execute_query_variables(self, query, variables): 'Content-Type': 'application/json' } response = requests.post(self.url, headers=headers, json={'query': query, 'variables': variables}) - response.raise_for_status() if response.status_code != 200: raise Exception(f"Error: {response.content}") return response.json() diff --git a/APSToolkitPython/src/aps_toolkit/BIM360.py b/APSToolkitPython/src/aps_toolkit/BIM360.py index 16b6b99..9a70aa3 100644 --- a/APSToolkitPython/src/aps_toolkit/BIM360.py +++ b/APSToolkitPython/src/aps_toolkit/BIM360.py @@ -420,7 +420,8 @@ def get_urn_item_version(self, project_id: str, item_id: str, version: str): item_versions = response.json() for item_version in item_versions['data']: if str(item_version['attributes']['versionNumber']) == str(version): - return item_version['relationships']['derivatives']['data']['id'] + if 'derivatives' in item_version['relationships']: + return item_version['relationships']['derivatives']['data']['id'] return None def upload_file_item(self, project_id: str, folder_id: str, file_path: str):