diff --git a/pyTigerGraph/pyTigerGraph.py b/pyTigerGraph/pyTigerGraph.py index df06645b..e39cb036 100644 --- a/pyTigerGraph/pyTigerGraph.py +++ b/pyTigerGraph/pyTigerGraph.py @@ -33,7 +33,7 @@ def __init__(self, host: str = "http://127.0.0.1", graphname: str = "MyGraph", apiToken: str = "", useCert: bool = None, certPath: str = None, debug: bool = None, sslPort: Union[int, str] = "443", gcp: bool = False, jwtToken: str = "", dbVersion: str = ""): super().__init__(host, graphname, gsqlSecret, username, password, tgCloud, restppPort, - gsPort, gsqlVersion, version, apiToken, useCert, certPath, debug, sslPort, gcp, jwtToken, dbVersion) + gsPort, gsqlVersion, version, apiToken, useCert, certPath, debug, sslPort, gcp, jwtToken) self.gds = None self.ai = None diff --git a/pyTigerGraph/pyTigerGraphBase.py b/pyTigerGraph/pyTigerGraphBase.py index 16a1fa46..3e005863 100644 --- a/pyTigerGraph/pyTigerGraphBase.py +++ b/pyTigerGraph/pyTigerGraphBase.py @@ -36,7 +36,7 @@ def __init__(self, host: str = "http://127.0.0.1", graphname: str = "MyGraph", tgCloud: bool = False, restppPort: Union[int, str] = "9000", gsPort: Union[int, str] = "14240", gsqlVersion: str = "", version: str = "", apiToken: str = "", useCert: bool = None, certPath: str = None, debug: bool = None, - sslPort: Union[int, str] = "443", gcp: bool = False, jwtToken: str = "", dbVersion: str = ""): + sslPort: Union[int, str] = "443", gcp: bool = False, jwtToken: str = ""): """Initiate a connection object. Args: @@ -78,8 +78,6 @@ def __init__(self, host: str = "http://127.0.0.1", graphname: str = "MyGraph", DEPRECATED. Previously used for connecting to databases provisioned on GCP in TigerGraph Cloud. jwtToken: The JWT token generated from customer side for authentication - dbVersion: - The TigerGraph database version being connected to. Raises: TigerGraphException: In case on invalid URL scheme. @@ -130,7 +128,8 @@ def __init__(self, host: str = "http://127.0.0.1", graphname: str = "MyGraph", # If JWT token is provided, set authMode to "token", and overwrite authMode = "pwd" for GSQL authentication as well if version is newer than 4.1.0 if jwtToken: - if dbVersion and StrictVersion(dbVersion) >= StrictVersion("4.1.0"): + dbVersion = self.getVer() + if StrictVersion(dbVersion) >= StrictVersion("4.1.0"): self.authMode = "token" self.jwtToken = jwtToken self.authHeader = {"Authorization": "Bearer " + self.jwtToken} diff --git a/tests/pyTigerGraphUnitTest.py b/tests/pyTigerGraphUnitTest.py index bd7c9918..cc59ceb8 100644 --- a/tests/pyTigerGraphUnitTest.py +++ b/tests/pyTigerGraphUnitTest.py @@ -20,8 +20,7 @@ def make_connection(graphname: str = None): "sslPort": "443", "tgCloud": False, "gcp": False, - "jwtToken": "", - "dbVersion": "" + "jwtToken": "" } path = os.path.dirname(os.path.realpath(__file__)) @@ -44,8 +43,7 @@ def make_connection(graphname: str = None): certPath=server_config["certPath"], sslPort=server_config["sslPort"], gcp=server_config["gcp"], - jwtToken=server_config["jwtToken"], - dbVersion=server_config["dbVersion"] + jwtToken=server_config["jwtToken"] ) if server_config.get("getToken", False): conn.getToken(conn.createSecret())