应答结果响应处理.

        将结果解析出来设置给任务对应的Future对象上

        Parameters:
            (response): - 响应的python字典形式数据

        Return:
            (bool): - 准确地说没有错误就会返回True
963211
def _result_handler(self, response: Dict[str, Any]):
        
        res = response.get("MESSAGE")
        result = res.get("RESULT")
        return result
1052637
def connect(self, callback=None, timeout=None):
        '''
        
        '''
        if hasattr(self, '_connecting_future') and not self._connecting_future.done():  # pylint: disable=E0203
            future = self._connecting_future  # pylint: disable=E0203
        else:
            if hasattr(self, '_connecting_future'):
                # read previous future result to prevent the "unhandled future exception" error
                self._connecting_future.exception()  # pylint: disable=E0203
            future = tornado.concurrent.Future()
            self._connecting_future = future
            self._connect(timeout=timeout)

        if callback is not None:
            def handle_future(future):
                response = future.result()
                self.io_loop.add_callback(callback, response)
            future.add_done_callback(handle_future)

        return future
671033
def request_update(self):
        
        with self._lock:
            self._need_update = True
            if not self._future or self._future.is_done:
              self._future = Future()
            return self._future
631106
def waitForURL(url, max_seconds=None):
    

    startTime = datetime.now()
    while True:
        response = None
        try:
            response = urllib2.urlopen(HEADREQUEST(url))
        except urllib2.URLError:
            pass
        if response is not None and isinstance(response, urllib2.addinfourl):
            if response.getcode() == 200:
                # We're done, yay!
                return
        timeNow = datetime.now()
        timePassed = timeNow - startTime
        if max_seconds and max_seconds < timePassed.seconds:
            return
        print("Waiting on URL %s for %s so far" % (url, timePassed))
        time.sleep(30)
1219296
def QA_fetch_future_list_adv(collections=DATABASE.future_list):
    '''
    
    '''
    future_list_items = QA_fetch_future_list()
    if len(future_list_items) == 0:
        print("QA Error QA_fetch_future_list_adv call item for item in collections.find() return 0 item, maybe the DATABASE.future_list is empty!")
        return None
    return future_list_items
673874
def execute(self, requests, resp_generator, *args, **kwargs):
        '''
            
        '''
        result_futures = [self.executor_pool.submit(resp_generator, req, *args, **kwargs) for req in requests]
        resp = [res_future.result() for res_future in result_futures]
        return resp
18966
def _post_response(self, params):
        
        return self._session.post(
            self._api_url, data=params, timeout=self._timeout
        ).json(encoding="utf8")
682436
def get(self, timeout):
        

        # At first get we return a ping so the client immediately receives data
        if self._first:
            self._first = False
            return ("ping", PingStats.get(), {})

        try:
            (action, msg, kwargs) = yield from asyncio.wait_for(super().get(), timeout)
        except asyncio.futures.TimeoutError:
            return ("ping", PingStats.get(), {})
        return (action, msg, kwargs)
362221
def get_response(self, path, **params):
        
        url = "%s%s" % (self.base_url, path)
        return self._get_response(url, **params)
1172074
def status(self):
        
        response = self._get(url.status)
        self._check_response(response, 200)
        return self._create_response(response)
958118
def future(self):
        
        fut = asyncio.Future()
        self.connect(fut, self.AUTO_FUTURE)
        return fut
1277941
def askForPreviousFutures(self):
        """"""
        # Don't request it too often (otherwise it ping-pongs because)
        # the broker answer triggers the _poll of pop()
        if time.time() < self.lastStatus + POLLING_TIME / 1000:
            return
        self.lastStatus = time.time()

        for future in scoop._control.futureDict.values():
            # Skip the root future
            if scoop.IS_ORIGIN and future.id == (scoop.worker, 0):
                continue

            if future not in self.inprogress:
                self.socket.sendStatusRequest(future)
416972
def _on_access_token(self, future, response):
        
        content = escape.json_decode(response.body)
        if 'error' in content:
            LOGGER.error('Error fetching access token: %s', content['error'])
            future.set_exception(auth.AuthError('Github auth error: %s' %
                                                str(content['error'])))
            return
        callback = self.async_callback(self._on_github_user, future,
                                       content['access_token'])
        self.github_request('user', callback, content['access_token'])
1222961
def check_response(self, resp):
        

        # For successful API call, response code will be 200 (OK)
        if resp.ok:
            json = resp.json()
            self.response = ResponseHolder()
            self.response.response = json

            # Check the code
            if 'status' not in json:
                raise InvalidResponse('No status field')

            self.response.status = self.field_to_long(json['status'])
            if self.response.status != EBConsts.STATUS_OK:
                txt_status = self.get_text_status(json)
                raise InvalidStatus('Status is %s (%04X)'
                                    % (txt_status if txt_status is not None else "", self.response.status))

            if self.response_checker is not None:
                self.response_checker(self.response)

            return self.response

        else:
            # If response code is not ok (200), print the resulting http error code with description
            resp.raise_for_status()
        pass
17895
private boolean isSnapshotInProgressResponse(
            ClientResponse response) {
        if (response.getStatus() != ClientResponse.SUCCESS) {
            return false;
        }

        if (response.getResults() == null) {
            return false;
        }

        if (response.getResults().length < 1) {
            return false;
        }

        VoltTable results = response.getResults()[0];
        if (results.getRowCount() < 1) {
            return false;
        }

        boolean snapshotInProgress = false;
        while (results.advanceRow()) {
            if (results.getString("RESULT").equals("FAILURE")) {
                if (results.getString("ERR_MSG").equals("SNAPSHOT IN PROGRESS")) {
                    snapshotInProgress = true;
                }
            }
        }
        return snapshotInProgress;
    }
78478
def boolean_from_response(method, path, options = {})
      request(method, path, options)
      @last_response.status == 204
    rescue Octokit::NotFound
      false
    end
1185591
def process_response(self, request, response):
        
        process = False

        # Don't do anything for unsecure requests, unless DEBUG is on
        if not self.allow_http and not request.is_secure():
            return response

        if response.status_code == UNAUTHORIZED:
            pass
        elif response.status_code == FOUND:
            location = urllib_parse.urlparse(response['Location'])
            if location.path != settings.LOGIN_URL:
                # If it wasn't a redirect to the login page, we don't touch it.
                return response
            elif not self.is_agent_a_robot(request):
                # We don't touch requests made in order to be shown to humans.
                return response

        realm = getattr(settings, 'BASIC_AUTH_REALM', request.META.get('HTTP_HOST', 'restricted'))
        
        if response.status_code == FOUND:
            response = self.unauthorized_view(request)

        authenticate = response.get('WWW-Authenticate', None)
        if authenticate:
            authenticate = 'Basic realm="%s", %s' % (realm, authenticate)
        else:
            authenticate = 'Basic realm="%s"' % realm
        response['WWW-Authenticate'] = authenticate

        return response