Did I find the right examples for you? yes no

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)
Provides an available network interface address, for example
"192.168.1.3".

A `NetworkError` exception is raised in case of failure.

        def get_ip():
    """Provides an available network interface address, for example
       "192.168.1.3".

       A `NetworkError` exception is raised in case of failure."""
    try:
        try:
            ip = socket.gethostbyname(socket.gethostname())
        except socket.gaierror:  # for Mac OS X
            ip = socket.gethostbyname(socket.gethostname() + ".local")
    except socket.gaierror:
        # sometimes the hostname doesn't resolve to an ip address, in which
        # case this will always fail
        ip = None

    if ip is None or ip.startswith("127."):
        if mozinfo.isLinux:
            interfaces = _get_interface_list()
            for ifconfig in interfaces:
                if ifconfig[0] == 'lo':
                    continue
                else:
                    return ifconfig[1]
        elif mozinfo.isMac:
            ip = _parse_ifconfig()

    if ip is None:
        raise NetworkError('Unable to obtain network address')

    return ip
        


src/m/a/marionette_client-0.7.7/marionette/runner/base.py   marionette_client(Download)
    def start_httpd(self, need_external_ip):
        host = "127.0.0.1"
        if need_external_ip:
            host = moznetwork.get_ip()
        docroot = self.server_root or os.path.join(os.path.dirname(os.path.dirname(__file__)), 'www')

src/w/p/wptrunner-0.2.5/wptrunner/wptrunner.py   wptrunner(Download)
def get_options(product):
    return {"firefox": {"host": "localhost"},
            "servo": {"host": "localhost"},
            "b2g": {"host": moznetwork.get_ip()}}[product]
 

src/w/p/wptrunner-0.2.5/wptrunner/browser.py   wptrunner(Download)
    def start(self):
        locations = ServerLocations(filename=os.path.join(here, "server-locations.txt"))
 
#        preferences = self.load_prefs()
        profile = FirefoxProfile(locations=locations, proxy={"remote": moznetwork.get_ip()})#,