2

I am using this to get the IP of the visitor, I jsut wanted to know if I can also could get the hostname of the client :

@app.route('/',methods=['GET'])
def home():
    REAL_IP = request.environ.get('HTTP_X_REAL_IP', request.remote_addr)
    return render_template('home.html', REAL_IP=REAL_IP)

Note : I want to use python flask and not socket :

socket.gethostbyaddr("IP") 

I actually want to know the name of the laptop client not the router or any material if NAT is in place.

davidism
  • 121,510
  • 29
  • 395
  • 339
MouIdri
  • 1,300
  • 1
  • 18
  • 37
  • You'll have to do a DNS reverse lookup for the IP. They may take several seconds though, so I would recommend against doing it in-request. – AKX Sep 10 '18 at 13:42
  • This is the same discussion as this one : https://stackoverflow.com/questions/3003385/get-the-clients-computer-name – MouIdri Sep 10 '18 at 14:43

0 Answers0