# Module `netapp_ontap.utils`

Copyright © 2020 NetApp Inc. All rights reserved.

This module contains some of the common utility funcions used in the library.

## Functions

`def poll(response: requests.models.Response, connection: HostConnection = None, timeout: int = None, interval: int = None) -> NetAppResponse`

  Poll for a job to complete on the host.

  This function accepts an HTTP 202 response from the server and follows the associated job link. As long as the state of the job is not terminal, it continues retrieving the job and logs a status message as it changes.

  ## Args

  `response`
    The initial API response which contains 202 and the job link.
  `connection`
    An optional `HostConnection` object. This is required if there is no globally usable connection set for the library.
  `timeout`
    Seconds to wait before timing out of a poll request. If set, the value overrides the timeout set in the connection. Otherwise, the timeout set in the connection is used.
  `interval`
    Seconds to wait between REST API calls when checking the job status. If set, the value overrides the interval in the connection object. Otherwise, the interval set in connection object is used.

  ## Returns

  The API response.

  ## Raises

  `NetAppRestError`: If there was no connection available when the request was made (either passed in or set for the library), or if the job times out.