How do I get IP Addres in Python
<p>Is there any way to get the IP address in pure python (not Django)?</p>

<p>I found the code bellow, but i do not have a Request object.</p>

<pre><code>def get_client_ip(request):
    x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
    if x_forwarded_for:
        ip = x_forwarded_for.split(',')[-1].strip()
    else:
        ip = request.META.get('REMOTE_ADDR')
    return ip
</code></pre>
