66import io
77import json
88from time import sleep
9- from typing import Any , Dict , List , Union
9+ from typing import Dict , List , Union
1010from urllib .parse import urljoin
1111
1212import requests
@@ -105,6 +105,9 @@ def add_target(
105105 """
106106 Add a target to a Vuforia Web Services database.
107107
108+ See
109+ https://library.vuforia.com/articles/Solution/How-To-Use-the-Vuforia-Web-Services-API#How-To-Add-a-Target.
110+
108111 Args:
109112 name: The name of the target.
110113 width: The width of the target.
@@ -137,9 +140,12 @@ def add_target(
137140
138141 return str (response .json ()['target_id' ])
139142
140- def get_target (self , target_id : str ) -> Dict [str , Any ]:
143+ def get_target_record (self , target_id : str ) -> Dict [str , Union [ str , int ] ]:
141144 """
142- Get details of a given target.
145+ Get a given target's target record from the Target Management System.
146+
147+ See
148+ https://library.vuforia.com/articles/Solution/How-To-Use-the-Vuforia-Web-Services-API#How-To-Add-a-Target.
143149
144150 Args:
145151 target_id: The ID of the target to get details of.
@@ -156,7 +162,7 @@ def get_target(self, target_id: str) -> Dict[str, Any]:
156162 base_vws_url = self ._base_vws_url ,
157163 )
158164
159- return dict (response .json ())
165+ return dict (response .json ()[ 'target_record' ] )
160166
161167 @timeout_decorator .timeout (seconds = 60 * 5 )
162168 def wait_for_target_processed (self , target_id : str ) -> None :
@@ -172,15 +178,20 @@ def wait_for_target_processed(self, target_id: str) -> None:
172178 than five minutes.
173179 """
174180 while True :
175- target_details = self .get_target (target_id = target_id )
176- if target_details ['status' ] != 'processing' :
181+ report = self .get_target_summary_report (target_id = target_id )
182+ if report ['status' ] != 'processing' :
177183 return
178184
179185 # We wait 0.2 seconds rather than less than that to decrease the
180186 # number of calls made to the API, to decrease the likelihood of
181187 # hitting the request quota.
182188 sleep (0.2 )
183189
190+ # We wait 0.2 seconds rather than less than that to decrease the
191+ # number of calls made to the API, to decrease the likelihood of
192+ # hitting the request quota.
193+ sleep (0.2 )
194+
184195 def list_targets (self ) -> List [str ]:
185196 """
186197 List target IDs.
0 commit comments