Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    On_Error/On_Close issue

    Python SDK
    2
    4
    91
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mohan1710 last edited by

      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.

      A 2 Replies Last reply Reply Quote 0
      • A
        admin @mohan1710 last edited by

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

        M 1 Reply Last reply Reply Quote 0
        • M
          mohan1710 @admin last edited by

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

          1 Reply Last reply Reply Quote 0
          • A
            admin @mohan1710 last edited by

            HI @mohan1710 said in On_Error/On_Close issue:

            on_error
            Kindly refer read me file.
            https://github.com/angelbroking-github/smartapi-python

            1 Reply Last reply Reply Quote 0
            • First post
              Last post