Skip to content

Commit

Permalink
Merge pull request #271 from tigergraph/restpp-path-same-port-fix
Browse files Browse the repository at this point in the history
Restpp path same port fix
  • Loading branch information
parkererickson-tg authored Jan 20, 2025
2 parents 4a8b4f7 + 2f3bd45 commit f37a155
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
8 changes: 6 additions & 2 deletions pyTigerGraph/common/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,18 @@ def __init__(self, host: str = "http://127.0.0.1", graphname: str = "MyGraph",

restppPort = str(restppPort)
sslPort = str(sslPort)
if self.tgCloud and (restppPort == "9000" or restppPort == "443"):
gsPort = str(gsPort)
if restppPort == gsPort:
self.restppPort = restppPort
self.restppUrl = self.host + ":" + restppPort + "/restpp"
elif self.tgCloud and (restppPort == "9000" or restppPort == "443"):
self.restppPort = sslPort
self.restppUrl = self.host + ":" + sslPort + "/restpp"
else:
self.restppPort = restppPort
self.restppUrl = self.host + ":" + self.restppPort

self.gsPort = ""
gsPort = str(gsPort)
if self.tgCloud and (gsPort == "14240" or gsPort == "443"):
self.gsPort = sslPort
self.gsUrl = self.host + ":" + sslPort
Expand Down
10 changes: 8 additions & 2 deletions pyTigerGraph/pyTigerGraphBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,20 @@ def __init__(self, host: str = "http://127.0.0.1", graphname: str = "MyGraph",
raise (TigerGraphException("Incorrect graphname."))

restppPort = str(restppPort)
gsPort = str(gsPort)
sslPort = str(sslPort)
if self.tgCloud and (restppPort == "9000" or restppPort == "443"):
if restppPort == gsPort:
self.restppPort = restppPort
self.restppUrl = self.host + ":" + restppPort + "/restpp"
elif (self.tgCloud and (restppPort == "9000" or restppPort == "443")):
if restppPort == gsPort:
sslPort = gsPort
self.restppPort = sslPort
self.restppUrl = self.host + ":" + sslPort + "/restpp"
else:
self.restppPort = restppPort
self.restppUrl = self.host + ":" + self.restppPort
gsPort = str(gsPort)

self.gsPort = gsPort
if self.tgCloud and (gsPort == "14240" or gsPort == "443"):
self.gsPort = sslPort
Expand Down
3 changes: 1 addition & 2 deletions pyTigerGraph/pytgasync/pyTigerGraphGSQL.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ async def gsql(self, query: str, graphname: str = None, options=None) -> Union[s
authMode="pwd", resKey=None, skipCheck=True,
jsonResponse=False,
headers={"Content-Type": "text/plain"})

except httpx.HTTPError as e:
except httpx.HTTPStatusError as e:
if e.response.status_code == 404:
res = await self._req("POST",
self.gsUrl + "/gsqlserver/gsql/file",
Expand Down

0 comments on commit f37a155

Please sign in to comment.