Tutorials
API Documentation
Some useful tools for network.
hbutils.system.network.
hostfile
Get host file in this os.
Host file path in this os.
Note
This should be /etc/hosts on Linux and macOS, but c:\windows\system32\drivers\etc\hosts on Windows.
/etc/hosts
c:\windows\system32\drivers\etc\hosts
get_hosts
Get hosts content in form of dictionary.
A dictionary of the hosts file.
>>> from hbutils.system import get_hosts >>> get_hosts() {'hansbug-VirtualBox': '127.0.0.1', 'localhost': '127.0.0.1'}
get_localhost_ip
Get ip address of localhost. It will be checked in hosts, and just return 127.0.0.1 is not found.
127.0.0.1
IP address of localhost.
localhost
>>> from hbutils.system import get_localhost_ip >>> get_localhost_ip() '127.0.0.1'