network
dev_tool.tools.network
log = logging.getLogger(__name__)
module-attribute
get_local_ip
A function that gets the local IP address of the machine.
On Linux/WSL, returns '0.0.0.0' to allow external access.
Returns:
-
str–The local IP address, or '127.0.0.1' if it cannot be determined.
Source code in dev_tool/tools/network.py
is_port_ready
A function that waits for a port to accept connections.
Parameters:
-
host(str) –The host address to check.
-
port(int) –The port number to check.
-
timeout(float, default:30.0) –The maximum time to wait in seconds.
Returns:
-
bool–True if the port is ready, False if the timeout was reached.