Skip to content
Snippets Groups Projects
Commit 8207347e authored by Moul's avatar Moul
Browse files

[mod] #139: Rename ConnectionHandler.{server,address}

parent f86e281c
No related branches found
No related tags found
2 merge requests!157v1.0.0rc0: merge dev into master,!149#139: Endpoints: renamings
Pipeline #13067 waiting for manual action
...@@ -189,17 +189,17 @@ class API: ...@@ -189,17 +189,17 @@ class API:
# remove starting slash in path if present # remove starting slash in path if present
path = path.lstrip("/") path = path.lstrip("/")
server, port = self.connection_handler.server, self.connection_handler.port address, port = self.connection_handler.address, self.connection_handler.port
if self.connection_handler.path: if self.connection_handler.path:
url = "{scheme}://{server}:{port}/{api_path}".format( url = "{scheme}://{address}:{port}/{api_path}".format(
scheme=scheme, scheme=scheme,
server=server, address=address,
port=port, port=port,
api_path=self.connection_handler.path, api_path=self.connection_handler.path,
) )
else: else:
url = "{scheme}://{server}:{port}".format( url = "{scheme}://{address}:{port}".format(
scheme=scheme, server=server, port=port scheme=scheme, address=address, port=port
) )
if len(path.strip()) > 0: if len(path.strip()) > 0:
...@@ -332,7 +332,7 @@ class Client: ...@@ -332,7 +332,7 @@ class Client:
Init Client instance Init Client instance
:param _endpoint: Endpoint string in duniter format :param _endpoint: Endpoint string in duniter format
:param proxy: Proxy server as hostname:port (optional, default None) :param proxy: Proxy address as hostname:port (optional, default None)
""" """
if isinstance(_endpoint, str): if isinstance(_endpoint, str):
# Endpoint Protocol detection # Endpoint Protocol detection
......
...@@ -23,13 +23,13 @@ from ..documents import MalformedDocumentError ...@@ -23,13 +23,13 @@ from ..documents import MalformedDocumentError
class ConnectionHandler: class ConnectionHandler:
"""Helper class used by other API classes to ease passing server connection information.""" """Helper class used by other API classes to ease passing address connection information."""
def __init__( def __init__(
self, self,
http_scheme: str, http_scheme: str,
ws_scheme: str, ws_scheme: str,
server: str, address: str,
port: int, port: int,
path: str, path: str,
proxy: Optional[str] = None, proxy: Optional[str] = None,
...@@ -39,20 +39,20 @@ class ConnectionHandler: ...@@ -39,20 +39,20 @@ class ConnectionHandler:
:param http_scheme: Http scheme :param http_scheme: Http scheme
:param ws_scheme: Web socket scheme :param ws_scheme: Web socket scheme
:param server: Server IP or domain name :param address: Domain name, IPv6, or IPv4 address
:param port: Port number :param port: Port number
:param port: Url path :param port: Url path
:param proxy: Proxy (optional, default=None) :param proxy: Proxy (optional, default=None)
""" """
self.http_scheme = http_scheme self.http_scheme = http_scheme
self.ws_scheme = ws_scheme self.ws_scheme = ws_scheme
self.server = server self.address = address
self.port = port self.port = port
self.path = path self.path = path
self.proxy = proxy self.proxy = proxy
def __str__(self) -> str: def __str__(self) -> str:
return "connection info: %s:%d" % (self.server, self.port) return "connection info: %s:%d" % (self.address, self.port)
# required to type hint cls in classmethod # required to type hint cls in classmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment