Skip to content

Commit

Permalink
port conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Liquid369 committed Oct 26, 2024
1 parent 2f6f5de commit c32f8db
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/rpcClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c32f8db

Please sign in to comment.