LongRunningOperation Class

Provides default logic for interpreting operation responses and status updates.

Inheritance
builtins.object
LongRunningOperation

Constructor

LongRunningOperation(response, deserialization_callback, lro_options=None, **kwargs)

Parameters

response
<xref:requests.Response>
Required

The initial response.

deserialization_callback
callable
Required

The deserialization callaback.

lro_options
dict
default value: None

LRO options.

kwargs
Required

Unused for now

Methods

get_status_from_async

Process the latest status update retrieved from a 'azure-asyncoperation' header.

get_status_from_location

Process the latest status update retrieved from a 'location' header.

get_status_from_resource

Process the latest status update retrieved from the same URL as the previous request.

get_status_link
parse_resource

Assuming this response is a resource, use the deserialization callback to parse it. If body is empty, assuming no resource to return.

set_async_url_if_present
set_initial_status

Process first response after initiating long running operation and set self.status attribute.

should_do_final_get

Check whether the polling should end doing a final GET.

get_status_from_async

Process the latest status update retrieved from a 'azure-asyncoperation' header.

get_status_from_async(response)

Parameters

response
<xref:requests.Response>
Required

latest REST call response.

Exceptions

<xref:BadResponse if response has no body>, <xref:or body does notcontain status.>

get_status_from_location

Process the latest status update retrieved from a 'location' header.

get_status_from_location(response)

Parameters

response
<xref:requests.Response>
Required

latest REST call response.

Exceptions

BadResponse if response has no body and not status 202.

get_status_from_resource

Process the latest status update retrieved from the same URL as the previous request.

get_status_from_resource(response)

Parameters

response
<xref:requests.Response>
Required

latest REST call response.

Exceptions

BadResponse if status not 200 or 204.
get_status_link()

Exceptions

<xref:BadResponse if response has no body>, <xref:or body does notcontain status.>

parse_resource

Assuming this response is a resource, use the deserialization callback to parse it. If body is empty, assuming no resource to return.

parse_resource(response)

Parameters

response
Required

Exceptions

<xref:BadResponse if response has no body>, <xref:or body does notcontain status.>

set_async_url_if_present

set_async_url_if_present(response)

Parameters

response
Required

Exceptions

<xref:BadResponse if response has no body>, <xref:or body does notcontain status.>

set_initial_status

Process first response after initiating long running operation and set self.status attribute.

set_initial_status(response)

Parameters

response
<xref:requests.Response>
Required

initial REST call response.

Exceptions

<xref:BadResponse if response has no body>, <xref:or body does notcontain status.>

should_do_final_get

Check whether the polling should end doing a final GET.

should_do_final_get()

Parameters

response
<xref:requests.Response>
Required

latest REST call response.

Return type

Exceptions

<xref:BadResponse if response has no body>, <xref:or body does notcontain status.>