mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-09-03 20:35:09 +00:00
return results for new command for commands marked with the deprecated decorator
This commit is contained in:
parent
667f417060
commit
46c5a98752
1 changed files with 5 additions and 19 deletions
|
@ -87,10 +87,6 @@ class UnknownAPIMethodError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class DeprecatedAPIMethodError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class NotAllowedDuringStartupError(Exception):
|
class NotAllowedDuringStartupError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -339,12 +335,6 @@ class AuthJSONRPCServer(AuthorizedBase):
|
||||||
request, id_
|
request, id_
|
||||||
)
|
)
|
||||||
return server.NOT_DONE_YET
|
return server.NOT_DONE_YET
|
||||||
except DeprecatedAPIMethodError:
|
|
||||||
self._render_error(
|
|
||||||
JSONRPCError(None, JSONRPCError.CODE_METHOD_NOT_FOUND),
|
|
||||||
request, id_
|
|
||||||
)
|
|
||||||
return server.NOT_DONE_YET
|
|
||||||
|
|
||||||
if args == EMPTY_PARAMS or args == []:
|
if args == EMPTY_PARAMS or args == []:
|
||||||
args_dict = {}
|
args_dict = {}
|
||||||
|
@ -472,14 +462,6 @@ class AuthJSONRPCServer(AuthorizedBase):
|
||||||
else:
|
else:
|
||||||
return server_port[0], 80
|
return server_port[0], 80
|
||||||
|
|
||||||
def _check_deprecated(self, function_path):
|
|
||||||
if function_path in self.deprecated_methods:
|
|
||||||
new_command = self.deprecated_methods[function_path]._new_command
|
|
||||||
log.warning('API function \"%s\" is deprecated, please update to use \"%s\"',
|
|
||||||
function_path, new_command)
|
|
||||||
|
|
||||||
raise DeprecatedAPIMethodError(function_path)
|
|
||||||
|
|
||||||
def _verify_method_is_callable(self, function_path):
|
def _verify_method_is_callable(self, function_path):
|
||||||
if function_path not in self.callable_methods:
|
if function_path not in self.callable_methods:
|
||||||
raise UnknownAPIMethodError(function_path)
|
raise UnknownAPIMethodError(function_path)
|
||||||
|
@ -488,7 +470,11 @@ class AuthJSONRPCServer(AuthorizedBase):
|
||||||
raise NotAllowedDuringStartupError(function_path)
|
raise NotAllowedDuringStartupError(function_path)
|
||||||
|
|
||||||
def _get_jsonrpc_method(self, function_path):
|
def _get_jsonrpc_method(self, function_path):
|
||||||
self._check_deprecated(function_path)
|
if function_path in self.deprecated_methods:
|
||||||
|
new_command = self.deprecated_methods[function_path]._new_command
|
||||||
|
log.warning('API function \"%s\" is deprecated, please update to use \"%s\"',
|
||||||
|
function_path, new_command)
|
||||||
|
function_path = new_command
|
||||||
self._verify_method_is_callable(function_path)
|
self._verify_method_is_callable(function_path)
|
||||||
return self.callable_methods.get(function_path)
|
return self.callable_methods.get(function_path)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue