Navigation

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

    Connection Error while login.

    Test
    0
    4
    34
    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.
    • P
      Phanilbb last edited by Phanilbb

      Im getting the below error while trying to login.

      ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

      This is the code. Its working sometimes and sometimes not.

      def create_session(angel_one_details):
          headers = {
              'Content-Type': 'application/json',
              'Accept': 'application/json',
              'X-UserType': 'USER',
              'X-SourceID': 'WEB',
              'X-PrivateKey': angel_one_details['api_key'],
              'X-ClientLocalIP': "127.0.0.1",
              'X-ClientPublicIP': "106.193.147.98",
              'X-MACAddress': ':'.join(re.findall('..', '%012x' % uuid.getnode())),
          }
          totp = pyotp.TOTP(angel_one_details['totp'])
          payload = {
              'clientcode': angel_one_details['id'],
              'password': angel_one_details['pin'],
              'totp': str(totp.now())
          }
          r = requests.post(ANGEL_ONE_LOGIN_URL, data=json.dumps(payload), headers=headers)
          print("Angle one login response : {}".format(r.text))
          if r.status_code != 200:
              raise errors.CustomError("Angle one login Failed {}".format(r.text))
          return r.json()
      
      B 1 Reply Last reply Reply Quote 0
      • B
        bm0126782 @Phanilbb last edited by

        @Phanilbb same with me.

        ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

        Don't know what happen.
        @admin123

        A 1 Reply Last reply Reply Quote 0
        • A
          anurag31 @bm0126782 last edited by

          same issue

          1 Reply Last reply Reply Quote 0
          • A
            Ardent last edited by

            @Phanilbb said in Connection Error while login.:

            angel

            Write a clean code
            If errors.CustomError is a custom class, import it from its module.
            also, Validate the JSON response structure.
            Correct "Angle" to "Angel" in the error message

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