diff --git a/src/rpcClient.py b/src/rpcClient.py index 16908e5..4690a6e 100644 --- a/src/rpcClient.py +++ b/src/rpcClient.py @@ -40,8 +40,16 @@ def __init__(self, rpc_protocol: str, rpc_host: str, rpc_user: str, rpc_password self.rpc_url = f"{rpc_protocol}://{rpc_user}:{rpc_password}@{rpc_host}" - host, port = rpc_host.split(":") - port = int(port) + if ":" in rpc_host: + host, port_str = rpc_host.split(":") + try: + port = int(port_str) + except ValueError: + raise ValueError(f"Invalid port specified: {port_str}") + else: + host = rpc_host + port = None + if rpc_protocol == "https": self.httpConnection = httplib.HTTPSConnection(host, port, timeout=20, context=ssl._create_unverified_context()) else: