get - Getting IP addresses from users using Python? -
i know right code in order ip address user after visiting website using python. i've searched nothing found.
thanks in advance
my guess running django? if use snippet(just call in view function):
def get_client_ip(request): x_forwarded_for = request.meta.get('http_x_forwarded_for') if x_forwarded_for: ip = x_forwarded_for.split(',')[0] else: ip = request.meta.get('remote_addr') return ip
Comments
Post a Comment