Hi,
Trying to connect to tigergraph cloud instance from python shell
graph=tg.TigerGraphConnection(host=“https://medigraph.i.tgcloud.io”,graphname=“mediagraph”,gsqlVersion=“3.0.5”,username=…,password=…,useCert=True)
results=graph.getEndpoints()
Facing following error:
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://medigraph.i.tgcloud.io:9000/endpoints/mediagraph?builtin=true
Complete Error - {“version”:{“edition”:“enterprise”,“api”:“v2”,“schema”:37},“error”:true,“message”:“Access Denied because the input token = ‘’ is invalid for graph ‘mediagraph’”,“code”:“REST-10016”}
Next, tried to get the apiToken and use it in the connection string.
(unable to post the complete message as the software not allowing me to add more than one link)
But still getting the same unauthorized error.
Any help will be highly appreciated as I urgently need to create a sample python code to execute query and detect some clusters.
Thanks
Ken
This is how I tried to provide the apiToken in the second attempt
curl -X GET “https://medigraph.i.tgcloud.io:9000/requesttoken?secret=…&lifetime=1000000”
graph=tg.TigerGraphConnection(host=“https://medigraph.i.tgcloud.io”,graphname=“mediagraph”,gsqlVersion=“3.0.5”,username="…",password="…",apiToken="…")
Hi @tigerfan
Can you share the error code from the terminal
What’s you pyTigerGraph version ?
Thanks
pyTigerGraph version 0.0.9.6.6
terminal error code 401
terminal error message: requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://medigraph.i.tgcloud.io:9000/endpoints/mediagraph?builtin=true
when I click the above link in error message , I see error code REST-10016
{“version”:{“edition”:“enterprise”,“api”:“v2”,“schema”:37},“error”:true,“message”:“Access Denied because the input token = ‘’ is invalid for graph ‘mediagraph’”,“code”:“REST-10016”}
@tigerfan all should be good
I think you should double check that the secret is belonging to that graph
Hi,
I have only one graph and only one secret.
The problem got resolved after I deleted all the secrets, changed password (not checked if it has anything to do with authorization) and recreated the token from a new secret.
Thanks
2 Likes
Great ! Glad you sorted it out