Navigation

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

    "Exception while retriving IP Address,using local host IP address" causing performance issues.

    Python SDK
    0
    6
    52
    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.
    • R
      ravitandur last edited by

      I am using python smart api to connect with my trading account and execute the trades.
      My code is deployed in AWS and I am using AWS Lambda functions for executing the API calls through the smart API python library.
      For some of the requests, it is taking a very long time [more than 6 minutes], when I debugged the issue the below code is causing the delay. Based on the below code I don't see the need of getting the clientPublicIP and clientLocalIp as at the finally block we are overwriting these values. Can u please check and get rid of this un necessary code which is causing delays in executing the critical APIs.
      Call me at 9885577812 to discuss further on this issue?
      try:
      clientPublicIp= " " + get('https://api.ipify.org').text
      if " " in clientPublicIp:
      clientPublicIp=clientPublicIp.replace(" ","")
      hostname = socket.gethostname()
      clientLocalIp=socket.gethostbyname(hostname)
      except Exception as e:
      print("Exception while retriving IP Address,using local host IP address",e)
      finally:
      clientPublicIp="106.193.147.98"
      clientLocalIp="127.0.0.1"

      punit 1 Reply Last reply Reply Quote 0
      • R
        ravitandur last edited by

        a4e55632-766d-435d-b497-df9ad8fece0c-image.png

        In the above, request is initiated at 15:18 and we see the Exception at 15:24 and based on the debugging it is taking time in the code mentioned above which is not required.

        1 Reply Last reply Reply Quote 0
        • R
          ravitandur last edited by

          @admin if I want to modify python code what is the process. I want to remove above code mentioned and commit the changes into git repo. Please suggest what needs to be done?

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

            Hi @ravitandur

            We have tried using the SDKs and did not experience any lag in order execution, , it is possible that the issue is specific to your setup or usage of the SDKs. It is always a good idea to seek help from the SmartAPI community here.

            1 Reply Last reply Reply Quote 0
            • punit
              punit @ravitandur last edited by

              @ravitandur You can comment the api call for the public IP. I have done it and have no impact on the functionality.

              DM me if you have any more questions.

              1 Reply Last reply Reply Quote 0
              • R
                ravitandur @ravitandur last edited by

                @admin @Ashok Can u please help me how to modify the python code and commit the changes back?

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