On_Error/On_Close issue


  • I have coded on_error, on_close in the streamer as given in the sample github code. Code is given below:

    def on_error(ws, code, reason):
    logging.debug("Connection error: {code} - {reason}".format(code=code, reason=reason))

    def on_close(ws, code, reason):
    logging.debug("on close")

    In the middle of the streamer getting the error as like:
    [2021-08-31 14:42:00,457] {_logging.py:67} ERROR - error from callback <bound method SmartWebSocket.__on_error of <smartapi.smartApiWebsocket.SmartWebSocket object at 0x00000257B6F86F70>>: on_error() missing 1 required positional argument: 'reason'
    [2021-08-31 14:42:00,457] {_logging.py:67} ERROR - error from callback <bound method SmartWebSocket.__on_close of <smartapi.smartApiWebsocket.SmartWebSocket object at 0x00000257B6F86F70>>: __on_close() takes 2 positional arguments but 4 were given
    [2021-08-31 14:42:00,457] {_logging.py:67} ERROR - error from callback <bound method SmartWebSocket.__on_close of <smartapi.smartApiWebsocket.SmartWebSocket object at 0x00000257B6F86F70>>: __on_close() takes 2 positional arguments but 4 were given

    Can you please suggest the correct code to solve this issue by providing the right parameters.



  • @admin , Kindly explain how many parameters to be passed to on_close and on_error methods?


  • HI @mohan1710 This is a user specific requirement we can help you with the technical issue related to our Apis.