azure.core.polling

class azure.core.polling.LROPoller(client: Any, initial_response: Any, deserialization_callback: Callable, polling_method: PollingMethod[PollingReturnType])[source]

Poller for long running operations.

Parameters
  • client (PipelineClient) – A pipeline service client

  • initial_response (PipelineResponse) – 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: Callable)None[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.

continuation_token()str[source]

Return a continuation token that allows to restart the poller later.

Returns

An opaque continuation token

Return type

str

done()bool[source]

Check status of the long running operation.

Returns

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

Return type

bool

classmethod from_continuation_token(polling_method: PollingMethod[PollingReturnType], continuation_token: str, **kwargs: Any) → LROPoller[PollingReturnType][source]
polling_method() → azure.core.polling._poller.PollingMethod[PollingReturnType][source]

Return the polling method associated to this poller.

remove_done_callback(func: Callable)None[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: Optional[int] = None) → PollingReturnType[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()str[source]

Returns the current status string.

Returns

The current status string

Return type

str

wait(timeout: Optional[int] = None)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()bool[source]

Is this polling finished?

Return type

bool

classmethod from_continuation_token(continuation_token, **kwargs)[source]
get_continuation_token()[source]
initialize(_: Any, initial_response: Any, deserialization_callback: Callable)None[source]
resource() → Any[source]
run()None[source]

Empty run, no polling.

status()str[source]

Return the current status as a string.

Return type

str

class azure.core.polling.PollingMethod[source]

ABC class for polling method.

finished()bool[source]
classmethod from_continuation_token(continuation_token, **kwargs)[source]
get_continuation_token()[source]
initialize(client: Any, initial_response: Any, deserialization_callback: Any)None[source]
resource() → PollingReturnType[source]
run()None[source]
status()str[source]
class azure.core.polling.AsyncNoPolling[source]

An empty async poller that returns the deserialized initial response.

finished()bool

Is this polling finished?

Return type

bool

classmethod from_continuation_token(continuation_token, **kwargs)
get_continuation_token()
initialize(_: Any, initial_response: Any, deserialization_callback: Callable)None
resource() → Any
async run()[source]

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

status()str

Return the current status as a string.

Return type

str

class azure.core.polling.AsyncPollingMethod[source]

ABC class for polling method.

finished()bool[source]
classmethod from_continuation_token(continuation_token: str, **kwargs) → Tuple[Any, Any, Callable][source]
get_continuation_token()str[source]
initialize(client: Any, initial_response: Any, deserialization_callback: Any)None[source]
resource() → PollingReturnType[source]
async run()None[source]
status()str[source]
class azure.core.polling.AsyncLROPoller(client: Any, initial_response: Any, deserialization_callback: Callable, polling_method: azure.core.polling._async_poller.AsyncPollingMethod[PollingReturnType])[source]

Async poller for long running operations.

Parameters
  • client (PipelineClient) – A pipeline service client

  • initial_response (PipelineResponse) – 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 (AsyncPollingMethod) – The polling strategy to adopt

continuation_token()str[source]

Return a continuation token that allows to restart the poller later.

Returns

An opaque continuation token

Return type

str

done()bool[source]

Check status of the long running operation.

Returns

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

Return type

bool

classmethod from_continuation_token(polling_method: azure.core.polling._async_poller.AsyncPollingMethod[PollingReturnType], continuation_token: str, **kwargs) → azure.core.polling._async_poller.AsyncLROPoller[PollingReturnType][source]
polling_method() → azure.core.polling._async_poller.AsyncPollingMethod[PollingReturnType][source]

Return the polling method associated to this poller.

async result() → PollingReturnType[source]

Return the result of the long running operation.

Returns

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

Raises

HttpResponseError – Server problem with the query.

status()str[source]

Returns the current status string.

Returns

The current status string

Return type

str

async wait()None[source]

Wait on the long running operation.

Raises

HttpResponseError – Server problem with the query.

async azure.core.polling.async_poller(client, initial_response, deserialization_callback, polling_method)[source]

Async Poller for long running operations.

Deprecated since version 1.5.0: Use AsyncLROPoller instead.

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

  • initial_response (PipelineResponse) – 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