Linux App Service (Python) - How to get initial IP RRS feed

  • Question

  • Dear all,

    I am running a Python app service on Linux (that internally is managed by a container) using Flask application.

    I would like to know how to get the initial requester IP, in the context of the container every request come from the ip of the docker internal network gateway.

    Any suggestion about this issue?



    Monday, September 9, 2019 10:30 AM

All replies

  • Hi Roberto,

    Apologies for the delay in response. Are you referring to getting the outbound IP for your python app? 

    Thursday, September 12, 2019 4:56 PM
  • Hi ,

    Could you please provide some more details on which IP are we looking for. Can you also elaborate the requirement.

    Tuesday, September 17, 2019 3:32 AM
  • Grandi, I think the below should help you capture the client IP address.

    from socket import gethostname, gethostbyname 
    ip = gethostbyname(gethostname()) 

    Or, if you are using CGI, you should be able to pull the client IP address from the REMOTE_ADDR environment variable.

    Saturday, September 28, 2019 4:09 AM