module documentation
Utility functions for network aspects.
| Function | get |
Lookup and return the IP address for a host name. |
| Function | is |
Check whether a TCP port is available. |
| Function | is |
Validate a host name. |
| Function | is |
Validate an IP address. |
| Function | is |
Validate a port number. |
| Function | is |
Validate a URL. |
| Function | ping |
Ping a TCP server on a specific port. |
| Variable | _allowed |
Regular expression for validating host names. |
Lookup and return the IP address for a host name.
| Parameters | |
hostname:str | None | The host name to look-up. If none is given, the own host name is tried. |
| Returns | |
str | IP address, or 127.0.0.1 as a last resort. None is returned in case of an error. |
Check whether a TCP port is available.
| Parameters | |
port:int | The port to check. |
| Returns | |
bool | True if port is available, or False otherwise. |
Validate a host name.
| Parameters | |
hostname:str | The host name to validate. |
| Returns | |
bool | True if the hostname is valid, or False otherwise. |
Validate a port number.
| Parameters | |
port:str | int | The port number to validate. |
| Returns | |
bool | True if port is valid, or False otherwise. |
Validate a URL.
| Parameters | |
url:str | The URL to validate. |
| Returns | |
bool | True if url is valid, or False otherwise. |