When I try to get the access token I am getting the response like this {'code': '500', 'data': JSONDecodeError('Expecting value: line 1 column 1 (char 0)',)}

When I try to get the access token I am getting the response like this {‘code’: ‘500’, ‘data’: JSONDecodeError(‘Expecting value: line 1 column 1 (char 0)’,)}

Hey Anith,
Can you send me the payload you are passing while generating the access token.

Hi @vikram_sri why I’m getting responses as given below..?

as “token” is upto date working while retrieving historical data..!

import os
from fyers_api.Websocket import ws
import time

access_token = "my token"
client_id = "my client id"
wsAccess_token = f"{client_id}:{access_token}"
symbolsData = {}
logPath = os.getcwd()

symbols = ['MCX:ALUMINIUM22OCTFUT', 'MCX:COPPER22OCTFUT']

data_type = "symbolData"
run_background = False

def custom_message(msg):
    global symbolsData, symName
    for symbol_data in msg:
        symbolsData = {symbol_data['symbol']: {
            'timestamp': symbol_data['timestamp'],
            'last_traded_time':symbol_data['last_traded_time'],
            'open_price': symbol_data['open_price'],
            'high_price': symbol_data['high_price'],
            'low_price': symbol_data['low_price'],
            'close_price': symbol_data['close_price'],
            'ltp': symbol_data['ltp'],
            'last_traded_qty': symbol_data['last_traded_qty']
        }}
        symName = symbol_data['symbol']
    return symbolsData

fyersSocket = ws.FyersSocket(access_token=wsAccess_token,run_background=run_background,log_path=logPath)
fyersSocket.websocket_data = custom_message
fyersSocket.subscribe(symbol=symbols,data_type=data_type)

while True:
    time.sleep(1)
    print("symbolsData => \n", symbolsData)

and response as below..

Response:{'s': 'error', 'code': -1600, 'message': 'Could not authenticate the user '}
{'s': 'error', 'code': -17, 'message': 'Could not authenticate the user'}