示例#1
0
 def make_request(self, method, params):
     if self.provider:
         response = self.provider.make_request(method, params)
         if response is None:
             return {'error': 'Empty response received'}
         return response
     raise CannotHandleRequest('No underlying provider is available')
示例#2
0
    def _proxy_request(self, method, params, use_cache=True):
        provider = self._get_active_provider(use_cache)
        if provider is None:
            raise CannotHandleRequest(
                "Could not discover provider while making request: "
                "method:{0}\n"
                "params:{1}\n".format(method, params))

        return provider.make_request(method, params)
示例#3
0
    def _proxy_request(self,
                       method: RPCEndpoint,
                       params: Any,
                       use_cache: bool = True) -> RPCResponse:
        provider = self._get_active_provider(use_cache)
        if provider is None:
            raise CannotHandleRequest(
                "Could not discover provider while making request: "
                f"method:{method}\nparams:{params}\n")

        return provider.make_request(method, params)
示例#4
0
    def _proxy_request(self, method, params, use_cache=True):
        provider = self._get_active_provider(use_cache)
        if provider is None:
            raise CannotHandleRequest("Could not discover provider")

        return provider.make_request(method, params)