pyTigerGraph - getschema() and conn.gsql() getting HTTPError and AuthenticationFailedException respectively

Hello, Trying to upload data using PyTigerGraph. Having some trouble in uploading the data.

When invoking getschema() method getting below error

HTTPError: 401 Client Error: Unauthorized for url:

Connection code:

#Generate authentication token 
graph = tg.TigerGraphConnection(host="", graphname="mygraph")

authToken = graph.getToken(<secret>) #secret generated in admin portal.
authToken = authToken[0]
print(f"SHHHH.... Keep this a secret. Here's your token: {authToken}")

SHHHH… Keep this a secret. Here’s your token: ***********************************

It made sure the establishment was successful. Also was able to add data using conn.upsertVertex and conn.upsertEdge method. Which is also reflected in the tgcloud.

Also while invoke conn.gsql(‘ls’) getting the below error

AuthenticationFailedException Traceback (most recent call last)
----> 1 print(conn.gsql(‘ls’))

3 frames
/usr/local/lib/python3.7/dist-packages/pyTigerDriver/ in _request(self, url, content, handler, cookie, auth)
307 ret_code = response.status
308 if ret_code == 401:
→ 309 raise AuthenticationFailedException(“Invalid Username/Password!”)
310 if handler:
311 reader = codecs.getreader(“utf-8”)(response)

AuthenticationFailedException: Invalid Username/Password!

Python 3.10

Hi karthik,

Which version of TigerGraph are you using?

If you’re using TGCloud 3.7 or newer, there is a new process for authenticating with your server from pyTigerGraph.

You’ll need to first create a database account to use when authenticating with pyTigerGraph. You can check out the video linked below on how to do that.

From pyTigerGraph, you will no longer need to use token and secret, but rather your username and password. You won’t need to create a token after connecting.

For example: conn = tg.TigerGraphConnection(host="", graphname="mygraph", username=<your_ussername>, password=<your_password>)