import socket


def getHostIP(url='www.google.com'):
    """Returns the (external) host ip for this machine"""
    s = socket.socket()
    try:
        s.connect((url, 80))
        return s.getsockname()[0]
    except Exception:
        return socket.gethostbyname(socket.gethostname())