Closed baaswietse closed 4 months ago
Hi @baaswietse , thank for your report, did you changed with your urn
and your token
?
@baaswietse need make sure your model translated : https://stackoverflow.com/questions/78099153/autodesk-forge-acc-file-not-translate-first-version?noredirect=1#comment137698456_78099153
Thank you for the response. I did translate the model using below code from the C# example. Using this urn in the C# example to extract Revit data works.
Can give me upgrade a latest version of python and try again ?
pip install aps-toolkit --upgrade
this is track detail issue i updated recenlly https://github.com/chuongmep/aps-toolkit/blob/838d38f222e2415a20dcfa743c96f14527973dde/APSToolkitPython/src/aps_toolkit/PropReader.py#L69
Still the same error, it seems the error is raised here: https://github.com/chuongmep/aps-toolkit/blob/838d38f222e2415a20dcfa743c96f14527973dde/APSToolkitPython/src/aps_toolkit/PropReader.py#L48C9-L48C23
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py:971, in Response.json(self, **kwargs)
970 try:
--> 971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
File ~\AppData\Local\Programs\Python\Python311\Lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
File ~\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w)
333 """Return the Python representation of ``s`` (a ``str`` instance
334 containing a JSON document).
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
File ~\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
JSONDecodeError Traceback (most recent call last)
Cell In[6], line 2
1 from aps_toolkit import PropDbReaderRevit
----> 2 prop_reader = PropDbReaderRevit(urn, token)
4 # categories = prop_reader.get_all_categories()
5 # # to dataframe with columns "dbid,category" from dict categories
6 # df = pd.DataFrame.from_dict(categories, orient='index', columns=["category"])
7 # df = df.reset_index()
8 # df = df.rename(columns={"index":"dbid"})
9 # df.head(20)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\aps_toolkit\PropReader.py:48, in PropReader.__init__(self, urn, token)
46 # request
47 response = requests.get(URL, headers=headers)
---> 48 json_response = response.json()
49 children = json_response['derivatives'][0]["children"]
50 path = ""
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py:975, in Response.json(self, **kwargs)
971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Hi @baaswietse , can give me paste this and see what is output from your side, after authentication
:
import requests
# get manifest
host = "https://developer.api.autodesk.com"
URL = f"{host}/modelderivative/v2/designdata/{urn}/manifest"
access_token = token.access_token
# add headers authorization
headers = {
"Authorization": f"Bearer {access_token}"
}
# request
response = requests.get(URL, headers=headers)
json_response = response.json()
json_response
I get the same error, response is a 404 object. Below code does work for C# example.
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py:971, in Response.json(self, **kwargs)
970 try:
--> 971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
File ~\AppData\Local\Programs\Python\Python311\Lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
File ~\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w)
333 """Return the Python representation of ``s`` (a ``str`` instance
334 containing a JSON document).
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
File ~\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
JSONDecodeError Traceback (most recent call last)
Cell In[10], line 21
19 response = requests.get(URL, headers=headers)
20 print(response)
---> 21 json_response = response.json()
23 json_response
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py:975, in Response.json(self, **kwargs)
971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
In this case, may be need you debug to see exaclly the detal issue, It can't find your urn
inside manifest
I found the issue, for projects located on EU servers you need a different manifest url. docs
https://developer.api.autodesk.com/modelderivative/v2/regions/eu/designdata/{urn}/manifest
Hi @baaswietse, how your output when modify to follow with "EMEA" region ?
import requests
# get manifest
host = "https://developer.api.autodesk.com"
URL = f"{host}/modelderivative/v2/designdata/{urn}/manifest"
access_token = token.access_token
# add headers authorization
headers = {
"Authorization": f"Bearer {access_token}",
"region": "EMEA"
}
# request
response = requests.get(URL, headers=headers)
json_response = response.json()
json_response
That works!
{'type': 'manifest',
'hasThumbnail': 'true',
'status': 'success',
'progress': 'complete',
'region': 'EMEA',
'urn': 'dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg',
'version': '1.0',
'derivatives': [{'name': 'Gent DB UZ Parking.rvt',
'hasThumbnail': 'true',
'status': 'success',
'progress': 'complete',
'messages': [{'type': 'warning',
'code': 'Revit-MissingLink',
'message': ['<message>Missing link files: <ul>{0}</ul></message>',
'Opmeting bestaande toestand_lokale link.dwg, P350301_UT_RIOF00 mail.dwg, TER_Nutsvoorzieningen_20230622 - verschoven.dwg']}],
'properties': {'Document Information': {'RVTVersion': '2023',
'Project Name': 'PROJECT NAAM',
'Project Number': 'PROJECT NUMMER',
'Author': '',
'Project Address': 'PROJECT ADRESS',
'Project Issue Date': 'AANMAAK DATUM PROJECT',
'Project Status': '',
'Building Name': '',
'Client Name': '',
'Organization Name': 'WYCKAERT',
'Organization Description': 'Hoofdaannemer'}},
'extractorVersion': '2026.6.6.1585',
'outputType': 'svf',
'overrideOutputType': 'svf2',
'children': [{'guid': '6fac95cb-af5d-3e4f-b943-8a7f55847ff1',
'type': 'resource',
'role': 'Autodesk.CloudPlatform.PropertyDatabase',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/model.sdb',
'mime': 'application/autodesk-db',
'status': 'success'},
{'guid': 'a4aac952-a3f4-031c-4113-b2d9ac2d0de6',
'type': 'resource',
'role': 'Autodesk.AEC.ModelData',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/AECModelData.json',
'mime': 'application/json',
'status': 'success'},
{'guid': '86b915c3-1e3e-915f-9e1f-c7154701a126',
'type': 'geometry',
'role': '3d',
'name': '3D',
'viewableID': '92b5dec7-790a-45b0-a5e8-cd9f76058c3a-00856259',
'phaseNames': 'New Construction',
'status': 'success',
'hasThumbnail': 'true',
'progress': 'complete',
'children': [{'guid': '92b5dec7-790a-45b0-a5e8-cd9f76058c3a-00856259',
'type': 'view',
'role': '3d',
'name': '3D',
'status': 'success',
'progress': 'complete',
'camera': [1606.8946533203125,
-2137.400146484375,
2099.274169921875,
-469.5074462890625,
-60.99797058105469,
22.872037887573242,
-0.40824830532073975,
0.40824830532073975,
0.8164966106414795,
1.5776996612548828,
0,
1,
1]},
{'guid': '26e84af5-5752-6260-3ad9-aa846d6386ff',
'type': 'resource',
'role': 'graphics',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/3D/3D.svf',
'mime': 'application/autodesk-svf'},
{'guid': 'c70aa596-d404-714f-6795-9276087c3800',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/3D/3D1.png',
'resolution': [100, 100],
'mime': 'image/png',
'status': 'success'},
{'guid': '6ef65d1a-4a59-111d-f1ec-4e543bd2712b',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/3D/3D2.png',
'resolution': [200, 200],
'mime': 'image/png',
'status': 'success'},
{'guid': '2c06739e-5164-4f6d-450e-c8833fd2a2ba',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/3D/3D4.png',
'resolution': [400, 400],
'mime': 'image/png',
'status': 'success'}]},
{'guid': 'e7314c63-2a21-30e4-7f25-5817cf2fb4a1',
'type': 'geometry',
'role': '3d',
'name': 'Existing',
'viewableID': 'c884ae1b-61e7-4f9d-0001-719e20b22d0b-00856265',
'phaseNames': 'Existing',
'status': 'success',
'hasThumbnail': 'true',
'progress': 'complete',
'children': [{'guid': 'c884ae1b-61e7-4f9d-0001-719e20b22d0b-00856265',
'type': 'view',
'role': '3d',
'name': 'Existing',
'status': 'success',
'progress': 'complete',
'camera': [709.262451171875,
-453.8277587890625,
482.779296875,
219.23492431640625,
36.19978332519531,
-7.2482757568359375,
-0.40824830532073975,
0.40824830532073975,
0.8164966106414795,
1.6683878898620605,
0,
1,
1]},
{'guid': '7d65c9ba-fea1-58aa-c14e-bf745517a790',
'type': 'resource',
'role': 'graphics',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/08f99ae5-b8be-4f8d-881b-128675723c10/Existing/Existing.svf',
'mime': 'application/autodesk-svf'},
{'guid': '6e470b9e-5c91-c9c2-992b-405a05a77140',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/08f99ae5-b8be-4f8d-881b-128675723c10/Existing/Existing1.png',
'resolution': [100, 100],
'mime': 'image/png',
'status': 'success'},
{'guid': '45afb182-f64c-e500-72ac-73f739549912',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/08f99ae5-b8be-4f8d-881b-128675723c10/Existing/Existing2.png',
'resolution': [200, 200],
'mime': 'image/png',
'status': 'success'},
{'guid': '17956c2c-5bc3-d1ae-50ee-d43300cf12bc',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/08f99ae5-b8be-4f8d-881b-128675723c10/Existing/Existing4.png',
'resolution': [400, 400],
'mime': 'image/png',
'status': 'success'}],
'isMasterView': True},
{'guid': '425041cf-4f70-6cc1-821a-e9b7d1f4021c',
'type': 'geometry',
'role': '3d',
'name': 'New Construction',
'viewableID': 'c884ae1b-61e7-4f9d-0002-719e20b22d0b-00856271',
'phaseNames': 'New Construction',
'status': 'success',
'hasThumbnail': 'true',
'progress': 'complete',
'children': [{'guid': 'c884ae1b-61e7-4f9d-0002-719e20b22d0b-00856271',
'type': 'view',
'role': '3d',
'name': 'New Construction',
'status': 'success',
'progress': 'complete',
'camera': [1791.246337890625,
-2144.671875,
2316.12744140625,
-402.0300598144531,
48.6046142578125,
122.85103607177734,
-0.40824830532073975,
0.40824830532073975,
0.8164966106414795,
1.434765100479126,
0,
1,
1]},
{'guid': 'bfbda299-064b-3970-f97d-2d75c09e7896',
'type': 'resource',
'role': 'graphics',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/08f99ae5-b8be-4f8d-881b-128675723c10/New Construction/New Construction.svf',
'mime': 'application/autodesk-svf'},
{'guid': 'a3c19573-8948-7ae0-fb5c-75cab1d0e87a',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/08f99ae5-b8be-4f8d-881b-128675723c10/New Construction/New Construction1.png',
'resolution': [100, 100],
'mime': 'image/png',
'status': 'success'},
{'guid': '86d53dd2-82c8-1948-5997-00ebf6078ed7',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/08f99ae5-b8be-4f8d-881b-128675723c10/New Construction/New Construction2.png',
'resolution': [200, 200],
'mime': 'image/png',
'status': 'success'},
{'guid': '7e36c074-8997-d941-4dc3-6a72fcdf3b9b',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/Resource/3D View/08f99ae5-b8be-4f8d-881b-128675723c10/New Construction/New Construction4.png',
'resolution': [400, 400],
'mime': 'image/png',
'status': 'success'}],
'isMasterView': True}]},
{'status': 'success',
'progress': 'complete',
'outputType': 'thumbnail',
'children': [{'guid': 'db899ab5-939f-e250-d79d-2d1637ce4565',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/preview1.png',
'resolution': [100, 100],
'mime': 'image/png',
'status': 'success'},
{'guid': '3f6c118d-f551-7bf0-03c9-8548d26c9772',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/preview2.png',
'resolution': [200, 200],
'mime': 'image/png',
'status': 'success'},
{'guid': '4e751806-0920-ce32-e9fd-47c3cec21536',
'type': 'resource',
'role': 'thumbnail',
'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLnBreG1NV1NRVFplNGZCMGxjQWk3QVE_dmVyc2lvbj0zMg/output/preview4.png',
'resolution': [400, 400],
'mime': 'image/png',
'status': 'success'}]}]}
Click to add a cell.
Hi @baaswietse , let's try again with latest python version 0.2.7
pip install aps-toolkit --upgrade
urn = "dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLkJBSUhTc09zVFdtY2tCYWdNMTNBWHc_dmVyc2lvbj0z"
prop_reader = PropDbReaderRevit(urn, token,"EMEA")
I can confirm this works now! Thank you.
Hello, upon running below code
I get a JSONDecodeError. With the same token and URN I am able to make the C# example work, so this would not be the issue.