mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change(rpc): handle 'version' and 'type' arguments in constructor
Additionally, added RPC.error, which produces an RPC-compatible error based on the version passed during construction. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
a06f4ec19c
commit
6662975005
2 changed files with 35 additions and 23 deletions
|
@ -61,6 +61,10 @@ async def rpc(request: Request,
|
|||
arg: Optional[str] = Query(None),
|
||||
args: Optional[List[str]] = Query(None, alias="arg[]")):
|
||||
|
||||
# Prepare output list of arguments.
|
||||
# Create a handle to our RPC class.
|
||||
rpc = RPC(version=v, type=type)
|
||||
|
||||
# Prepare list of arguments for input. If 'arg' was given, it'll
|
||||
# be a list with one element.
|
||||
arguments = parse_args(request)
|
||||
return JSONResponse(RPC().handle(v=v, type=type, args=arguments))
|
||||
return JSONResponse(rpc.handle(arguments))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue