Replace deprecated urllib.parse.splittype and splithost with urlparse.

This commit is contained in:
tecnovert 2020-02-11 00:33:29 +02:00
parent e293987fa8
commit e3b2213fe1
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93

View file

@ -37,10 +37,11 @@ class Jsonrpc():
# establish a "logical" server connection
# get the url
type, uri = urllib.parse.splittype(uri)
if type not in ("http", "https"):
parsed = urllib.parse.urlparse(uri)
if parsed.scheme not in ("http", "https"):
raise OSError("unsupported XML-RPC protocol")
self.__host, self.__handler = urllib.parse.splithost(uri)
self.__host = parsed.netloc
self.__handler = parsed.path
if not self.__handler:
self.__handler = "/RPC2"