WebSocket symbol subscribe issue

A while back, it run fine, but now the code isn't functioning.
issue:
I retrieve a symbol's data using Fyers API-v2 WebSocket, perform some operations with the data, but upon subscribing to my symbol in the WebSocket, the code returns a symbol key error. I've included my code and the error image below

websosket code:

 def websocket(self):
        try:
            path = os.getcwd()
            data_type = "symbolData"
            token = f'{self.app_id}:{self.access_token}'
            self.fyers_socket = ws.FyersSocket(access_token=token, log_path=path)
            
            def on_ticks(msg):
                print(msg,'.................')
                self.symbol_data = msg[0]
                # Enqueue the received data
                self.data_queue.put(msg[0])
                # print(msg[0])
                current_date = datetime.date.today()
                with open(f'.\daily_instrument_data\{current_date}.txt', "a") as file:
                # Step 2: Write the data to the file
                # for data in data_list:
                    file.write(str(msg[0]) + "\n")
                # self.message_queue.put(msg[0])
                # Do something with the received data
                # pass
            def on_close(msg):
                print(f'connection failed{msg}')
        

            self.fyers_socket.websocket_data = on_ticks
            self.fyers_socket.websocket_data = on_close
            self.fyers_socket.subscribe(symbol=self.symbol, data_type=data_type)
            self.fyers_socket.keep_running()
2
6 replies