From ff51e3b8648043cb2e1cce8d044b6c658e69555d Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 2 May 2023 11:26:22 +0100 Subject: [PATCH] xmlrpc: Enable 'allow_none' This is a custom extension to the XML-RPC spec so it's not enabled by default. In truth, the server shouldn't be returning `None` values but there's a bug somewhere. The server is frozen so we need to fix this here, on the client side. While we're here, 'Server' in the 'xmlrpc.client' library is a legacy alias for 'ServerProxy'. Update the call. Signed-off-by: Stephen Finucane Closes: #22 --- pwclient/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pwclient/api.py b/pwclient/api.py index 1373317..8a3ea44 100644 --- a/pwclient/api.py +++ b/pwclient/api.py @@ -154,7 +154,11 @@ def __init__(self, server, *, username=None, password=None, token=None): transport.set_credentials(username, password) try: - rpc = xmlrpc.xmlrpclib.Server(self._server, transport=transport) + rpc = xmlrpc.xmlrpclib.ServerProxy( + self._server, + transport=transport, + allow_none=True, + ) except (IOError, OSError): raise exceptions.APIError(f'Unable to connect to {self._server}')