1414
1515from azure .core .pipeline import PipelineResponse
1616from azure .core .polling import LROPoller , NoPolling , PollingMethod
17- from azure .core .polling .base_polling import LROBasePolling , OperationResourcePolling
17+ from azure .core .polling .base_polling import LROBasePolling
1818from azure .core .rest import HttpRequest , HttpResponse
1919from azure .core .tracing .decorator import distributed_trace
2020from azure .core .utils import case_insensitive_dict
@@ -41,17 +41,6 @@ def _parse_operation_id(operation_location_header):
4141 return re .match (regex , operation_location_header ).group (1 )
4242
4343
44- class DocumentModelAdministrationPolling (OperationResourcePolling ):
45- """Polling method overrides for administration endpoints."""
46-
47- def get_final_get_url (self , pipeline_response : Any ) -> None :
48- """If a final GET is needed, returns the URL.
49-
50- :param any pipeline_response: The pipeline response to get the final url.
51- :rtype: None
52- """
53- return None
54-
5544class AnalyzeDocumentLROPoller (LROPoller [PollingReturnType_co ]):
5645 @property
5746 def details (self ) -> Mapping [str , Any ]:
@@ -295,7 +284,7 @@ def get_long_running_output(pipeline_response):
295284 "str" , response .headers .get ("Operation-Location" )
296285 )
297286
298- deserialized = _deserialize (_models .DocumentModelDetails , response .json ()[ "result" ] )
287+ deserialized = _deserialize (_models .DocumentModelDetails , response .json (). get ( "result" ) )
299288 if cls :
300289 return cls (pipeline_response , deserialized , response_headers ) # type: ignore
301290 return deserialized
@@ -306,7 +295,13 @@ def get_long_running_output(pipeline_response):
306295
307296 if polling is True :
308297 polling_method : PollingMethod = cast (
309- PollingMethod , LROBasePolling (lro_delay , path_format_arguments = path_format_arguments , lro_algorithms = [DocumentModelAdministrationPolling ()], ** kwargs )
298+ PollingMethod ,
299+ LROBasePolling (
300+ lro_delay ,
301+ path_format_arguments = path_format_arguments ,
302+ lro_options = {"final-state-via" : "operation-location" },
303+ ** kwargs ,
304+ ),
310305 )
311306 elif polling is False :
312307 polling_method = cast (PollingMethod , NoPolling ())
@@ -359,7 +354,7 @@ def get_long_running_output(pipeline_response):
359354 "str" , response .headers .get ("Operation-Location" )
360355 )
361356
362- deserialized = _deserialize (_models .DocumentClassifierDetails , response .json ())
357+ deserialized = _deserialize (_models .DocumentClassifierDetails , response .json (). get ( "result" ) )
363358 if cls :
364359 return cls (pipeline_response , deserialized , response_headers ) # type: ignore
365360 return deserialized
@@ -370,7 +365,7 @@ def get_long_running_output(pipeline_response):
370365
371366 if polling is True :
372367 polling_method : PollingMethod = cast (
373- PollingMethod , LROBasePolling (lro_delay , path_format_arguments = path_format_arguments , ** kwargs )
368+ PollingMethod , LROBasePolling (lro_delay , path_format_arguments = path_format_arguments , lro_options = { "final-state-via" : "operation-location" }, ** kwargs )
374369 )
375370 elif polling is False :
376371 polling_method = cast (PollingMethod , NoPolling ())
0 commit comments