Kaushal-Chapaneri / tiger-stream

4 stars 0 forks source link

TigerGraphException: #4

Open Tabaxi3000 opened 2 years ago

Tabaxi3000 commented 2 years ago

('The request cannot be processed: expected a JSON payload, but a query string was given.\nPlease visit https://docs.tigergraph.com/tigergraph-server/current/api/built-in-endpoints#_authentication for more information.', 'REST-1101')

File "C:\Users\Caleb Choe\Desktop\tiger-stream-main\TigerStream.py", line 51, in conn = connect_tg() File "C:\Users\Caleb Choe\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\caching.py", line 603, in wrapped_func return get_or_create_cached_value() File "C:\Users\Caleb Choe\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\caching.py", line 587, in get_or_create_cached_value return_value = func(*args, **kwargs) File "C:\Users\Caleb Choe\Desktop\tiger-stream-main\utils.py", line 107, in connect_tg token = conn.getToken(TG_SECRET) File "C:\Users\Caleb Choe\AppData\Local\Programs\Python\Python39\lib\site-packages\pyTigerGraphBeta\pyTigerGraphBeta.py", line 1337, in getToken raise TigerGraphException(res["message"], (res["code"] if "code" in res else None))

Can anybody help here?

Kaushal-Chapaneri commented 2 years ago

Hi @Tabaxi3000 ,

There is some issue in getting Auth token from Tiger graph, occurred on following line :

File "C:\Users\Caleb Choe\Desktop\tiger-stream-main\utils.py", line 107, in connect_tg

token = conn.getToken(TG_SECRET)

make sure you have updated your credentials in config.json file , for that you can follow the steps mentioned in README.

Thanks.

Tabaxi3000 commented 2 years ago

I updated config.json and created this other .py document called demo.py to check for errors. When I run it, I get the following error:

Connection Failed check your Username/Password Expecting value: line 1 column 1 (char 0) Connection Failed check your Username/Password Expecting value: line 1 column 1 (char 0) Couldn't Initialize the client see Above Error

import pyTigerGraphBeta as tg import streamlit as st import streamlit.components.v1 as components

import json from bs4 import BeautifulSoup import pandas as pd from datetime import datetime import base64 import uuid import re

@st.cache def load_config(): """ function to load all credentials stored in config.json return :: json object containing all credentials """

with open('config.json', encoding='utf-8', errors='ignore') as f:
    config = json.load(f, strict=False)
    return config

config = load_config()

TG_HOST = config["tg_host"] TG_USERNAME = config["tg_username"] TG_PASSWORD = config["tg_password"] TG_GRAPHNAME = config["tg_graphname"] TG_SECRET = config["tg_secret"]

conn = tg.TigerGraphConnection(host=TG_HOST, username=TG_USERNAME, password=TG_PASSWORD, graphname=TG_GRAPHNAME)

secret = conn.createSecret() print(secret)

token = conn.getToken(secret)

token = conn.getToken(TG_SECRET, "30000")

print(token)