from gi.repository import Soup
from gi.repository import Gio

addr = Soup.Address(name='localhost', port=8000)
status = addr.resolve_sync(None)
print 'soup_address_resolve_sync returns status %d, addr %s' % (status, addr.get_physical())

resolver = Gio.Resolver.get_default()
addrs = resolver.lookup_by_name('localhost', None)
print 'g_resolver_lookup_by_name returns:'
for addr in addrs:
    print '  ' + addr.to_string()

