def _async_call(self, uri, body=None, method="GET", error_class=None,
            has_response=True, *args, **kwargs):
        api_methods = {
                "GET": self._retry_get,
                "POST": self.api.method_post,
                "PUT": self.api.method_put,
                "DELETE": self.api.method_delete,
                }
        api_method = api_methods[method]
        try:
            if body is None:
                resp, resp_body = api_method(uri, *args, **kwargs)
            else:
                resp, resp_body = api_method(uri, body=body, *args, **kwargs)
        except Exception as e:
            if error_class:
                raise error_class(e)
            else:
                raise

        callbackURL = resp_body["callbackUrl"].split("/status/")[-1]
        massagedURL = "/status/%s?showDetails=true" % callbackURL
        start = time.time()
        timed_out = False
        while (resp_body["status"] == "RUNNING") and not timed_out:
            resp_body = None
            while resp_body is None and not timed_out:
                resp, resp_body = self._retry_get(massagedURL)
                if self._timeout:
                    timed_out = ((time.time() - start) > self._timeout)
                    time.sleep(self._delay)

        if timed_out:
            raise exc.DNSCallTimedOut("The API call to '%s' did not complete "
                    "after %s seconds." % (uri, self._timeout))
        if error_class and (resp_body["status"] == "ERROR"):
            # This call will handle raising the error.
            self._process_async_error(resp_body, error_class)
        if has_response:
            ret = resp, resp_body["response"]
        else:
            ret = resp, resp_body
        try:
            resp_body = json.loads(resp_body)
        except Exception:
            pass
        return ret
Lookup multiple values by (timestamp, suffix) pairs.
dataset/ETHPy150Open rackspace/pyrax/pyrax/clouddns.py/CloudDNSManager._async_call--crossover with--dataset/ETHPy150Open google/grr/grr/lib/aff4_objects/sequential_collection.py/SequentialCollection.MultiResolve