azure.core.polling
- class azure.core.polling.AsyncLROPoller(client: Any, initial_response: Any, deserialization_callback: Callable[[Any], PollingReturnType_co], polling_method: AsyncPollingMethod[PollingReturnType_co])[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
- classmethod from_continuation_token(polling_method: AsyncPollingMethod[PollingReturnType_co], continuation_token: str, **kwargs: Any) AsyncLROPoller[PollingReturnType_co] [source]
Create a poller from a continuation token.
- Parameters:
polling_method (AsyncPollingMethod) – The polling strategy to adopt
continuation_token (str) – An opaque continuation token
- Returns:
An instance of AsyncLROPoller
- Return type:
- Raises:
HttpResponseError – If the continuation token is invalid.
- continuation_token() str [source]
Return a continuation token that allows to restart the poller later.
- Returns:
An opaque continuation token
- Return type:
- done() bool [source]
Check status of the long running operation.
- Returns:
‘True’ if the process has completed, else ‘False’.
- Return type:
- polling_method() AsyncPollingMethod[PollingReturnType_co] [source]
Return the polling method associated to this poller.
- Returns:
The polling method associated to this poller.
- Return type:
- async result() PollingReturnType_co [source]
Return the result of the long running operation.
- Returns:
The deserialized resource of the long running operation, if one is available.
- Return type:
any or None
- Raises:
HttpResponseError – Server problem with the query.
- status() str [source]
Returns the current status string.
- Returns:
The current status string
- Return type:
- async wait() None [source]
Wait on the long running operation.
- Raises:
HttpResponseError – Server problem with the query.
- class azure.core.polling.AsyncNoPolling[source]
An empty async poller that returns the deserialized initial response.
- classmethod from_continuation_token(continuation_token: str, **kwargs: Any) Tuple[Any, Any, Callable[[Any], PollingReturnType_co]]
Recreate the poller from a continuation token.
- Parameters:
continuation_token (str) – The continuation token to recreate the poller from.
- Return type:
Tuple[Any, Any, Callable[[Any], PollingReturnType_co]]
- Returns:
A tuple containing the client, initial response, and deserialization callback.
- Raises:
ValueError – If ‘deserialization_callback’ is not provided in kwargs.
- get_continuation_token() str
Return a continuation token that allows to restart the poller later.
- Return type:
- Returns:
An opaque continuation token
- initialize(_: Any, initial_response: Any, deserialization_callback: Callable[[Any], PollingReturnType_co]) None
Initialize the poller with the initial response and deserialization callback.
- Parameters:
_ (Any) – The client, not used in this polling method.
initial_response (Any) – The initial response from the long-running operation.
deserialization_callback (Callable[[Any], PollingReturnType_co]) – A callback that takes a response and returns a deserialized object.
- Returns:
None
- Return type:
None
- resource() PollingReturnType_co
Return the built resource.
- Return type:
any
- Returns:
The built resource.
- class azure.core.polling.AsyncPollingMethod[source]
ABC class for polling method.
- classmethod from_continuation_token(continuation_token: str, **kwargs: Any) Tuple[Any, Any, Any] [source]
Create a poller from a continuation token.
- Parameters:
continuation_token (str) – An opaque continuation token
- Returns:
A tuple containing the client, initial response, and deserialization callback.
- Return type:
Tuple[Any, Any, DeserializationCallbackType]
- finished() bool [source]
Check if the polling operation is finished.
- Returns:
True if the polling operation is finished, False otherwise.
- Return type:
- get_continuation_token() str [source]
Return a continuation token that allows to restart the poller later.
- Returns:
An opaque continuation token
- Return type:
- initialize(client: Any, initial_response: Any, deserialization_callback: Any) None [source]
Initialize the polling method with the client, initial response, and deserialization callback.
- 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 returns a deserialized object. If a subclass of Model is given, this passes “deserialize” as callback.
- Returns:
None
- Return type:
None
- resource() PollingReturnType_co [source]
Return the resource of the long running operation.
- Returns:
The deserialized resource of the long running operation, if one is available.
- Return type:
any
- class azure.core.polling.LROPoller(client: Any, initial_response: Any, deserialization_callback: Callable[[Any], PollingReturnType_co], polling_method: PollingMethod[PollingReturnType_co])[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
- classmethod from_continuation_token(polling_method: PollingMethod[PollingReturnType_co], continuation_token: str, **kwargs: Any) LROPoller[PollingReturnType_co] [source]
Create a poller from a continuation token.
- Parameters:
polling_method (PollingMethod) – The polling strategy to adopt
continuation_token (str) – An opaque continuation token
- Returns:
An instance of LROPoller
- Return type:
- Raises:
HttpResponseError – If the continuation token is invalid.
- 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:
- done() bool [source]
Check status of the long running operation.
- Returns:
‘True’ if the process has completed, else ‘False’.
- Return type:
- polling_method() PollingMethod[PollingReturnType_co] [source]
Return the polling method associated to this poller.
- Returns:
The polling method
- Return type:
- 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: float | None = None) PollingReturnType_co [source]
Return the result of the long running operation, or the result available after the specified timeout.
- Parameters:
timeout (float) – Period of time to wait before getting back control.
- Returns:
The deserialized resource of the long running operation, if one is available.
- Return type:
any or None
- Raises:
HttpResponseError – Server problem with the query.
- status() str [source]
Returns the current status string.
- Returns:
The current status string
- Return type:
- wait(timeout: float | None = 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 (float) – 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.
- classmethod from_continuation_token(continuation_token: str, **kwargs: Any) Tuple[Any, Any, Callable[[Any], PollingReturnType_co]]
Recreate the poller from a continuation token.
- Parameters:
continuation_token (str) – The continuation token to recreate the poller from.
- Return type:
Tuple[Any, Any, Callable[[Any], PollingReturnType_co]]
- Returns:
A tuple containing the client, initial response, and deserialization callback.
- Raises:
ValueError – If ‘deserialization_callback’ is not provided in kwargs.
- get_continuation_token() str
Return a continuation token that allows to restart the poller later.
- Return type:
- Returns:
An opaque continuation token
- initialize(_: Any, initial_response: Any, deserialization_callback: Callable[[Any], PollingReturnType_co]) None
Initialize the poller with the initial response and deserialization callback.
- Parameters:
_ (Any) – The client, not used in this polling method.
initial_response (Any) – The initial response from the long-running operation.
deserialization_callback (Callable[[Any], PollingReturnType_co]) – A callback that takes a response and returns a deserialized object.
- Returns:
None
- Return type:
None
- resource() PollingReturnType_co
Return the built resource.
- Return type:
any
- Returns:
The built resource.
- class azure.core.polling.PollingMethod[source]
ABC class for polling method.
- classmethod from_continuation_token(continuation_token: str, **kwargs: Any) Tuple[Any, Any, Any] [source]
Recreate the poller from a continuation token.
- Parameters:
continuation_token (str) – The continuation token to recreate the poller from.
- Return type:
Tuple[Any, Any, DeserializationCallbackType]
- Returns:
A tuple containing the client, initial response, and deserialization callback.
- finished() bool [source]
Check if the polling operation is finished.
- Return type:
- Returns:
True if the polling operation is finished, False otherwise.
- get_continuation_token() str [source]
Return a continuation token that allows to restart the poller later.
- Return type:
- Returns:
An opaque continuation token.
- resource() PollingReturnType_co [source]
Return the resource built by the polling operation.
- Return type:
any
- Returns:
The resource built by the polling operation.
- async azure.core.polling.async_poller(client: Any, initial_response: Any, deserialization_callback: Callable[[Any], PollingReturnType_co], polling_method: AsyncPollingMethod[PollingReturnType_co]) PollingReturnType_co [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
- Returns:
The final resource at the end of the polling.
- Return type:
any or None