azure.core.polling

class azure.core.polling.LROPoller(client, initial_response, deserialization_callback, polling_method)[source]

Poller for long running operations.

Parameters
  • client (PipelineClient) – A pipeline service client

  • initial_response (HttpResponse or AsyncHttpResponse) – The initial call response

  • deserialization_callback (callable or msrest.serialization.Model) – A callback that takes a Response and return a deserialized object. If a subclass of Model is given, this passes “deserialize” as callback.

  • polling_method (PollingMethod) – The polling strategy to adopt

add_done_callback(func)[source]

Add callback function to be run once the long running operation has completed - regardless of the status of the operation.

Parameters

func (callable) – Callback function that takes at least one argument, a completed LongRunningOperation.

done()[source]

Check status of the long running operation.

Returns

‘True’ if the process has completed, else ‘False’.

Return type

bool

remove_done_callback(func)[source]

Remove a callback from the long running operation.

Parameters

func (callable) – The function to be removed from the callbacks.

Raises

ValueError – if the long running operation has already completed.

result(timeout=None)[source]

Return the result of the long running operation, or the result available after the specified timeout.

Returns

The deserialized resource of the long running operation, if one is available.

Raises

HttpResponseError – Server problem with the query.

status()[source]

Returns the current status string.

Returns

The current status string

Return type

str

wait(timeout=None)[source]

Wait on the long running operation for a specified length of time. You can check if this call as ended with timeout with the “done()” method.

Parameters

timeout (int) – Period of time to wait for the long running operation to complete (in seconds).

Raises

HttpResponseError – Server problem with the query.

class azure.core.polling.NoPolling[source]

An empty poller that returns the deserialized initial response.

finished()[source]

Is this polling finished?

Return type

bool

initialize(_, initial_response, deserialization_callback)[source]
resource()[source]
run()[source]

Empty run, no polling.

status()[source]

Return the current status as a string.

Return type

str

class azure.core.polling.PollingMethod[source]

ABC class for polling method.

finished()[source]
initialize(client, initial_response, deserialization_callback)[source]
resource()[source]
run()[source]
status()[source]
class azure.core.polling.AsyncNoPolling[source]

An empty async poller that returns the deserialized initial response.

finished()

Is this polling finished?

Return type

bool

initialize(_, initial_response, deserialization_callback)
resource()
async run()[source]

Empty run, no polling. Just override initial run to add “async”

status()

Return the current status as a string.

Return type

str

class azure.core.polling.AsyncPollingMethod[source]

ABC class for polling method.

finished()[source]
initialize(client, initial_response, deserialization_callback)[source]
resource()[source]
async run()[source]
status()[source]
async azure.core.polling.async_poller(client, initial_response, deserialization_callback, polling_method)[source]

Async Poller for long running operations.

Parameters
  • client (PipelineClient) – A pipeline service client.

  • initial_response (AsyncHttpResponse) – The initial call response

  • deserialization_callback (callable or msrest.serialization.Model) – A callback that takes a Response and return a deserialized object. If a subclass of Model is given, this passes “deserialize” as callback.

  • polling_method (PollingMethod) – The polling strategy to adopt