fkie_mas_pylib.system.host module
- fkie_mas_pylib.system.host.HOSTS_CACHE = {}
- Variables:
HOSTS_CACHE – the cache directory to store the results of tests for local hosts.
is_local()
- fkie_mas_pylib.system.host.get_address_override() str | None
- Returns:
ROS_IP/ROS_HOSTNAME override or None,
str- Raises:
ValueErrorIf ROS_IP/ROS_HOSTNAME/__ip/__hostname are invalidly specified
- fkie_mas_pylib.system.host.get_host_name() str | None
- Determine host-name for use in host-name-based addressing (e.g. XML-RPC URIs):
if ROS_IP/ROS_HOSTNAME is set, use that address
if the hostname returns a non-localhost value, use that
use whatever L{get_local_address()} returns
- fkie_mas_pylib.system.host.get_hostname(url: str) str | None
Extracts the hostname from given url.
- Parameters:
url (str) – the url to parse
- Returns:
the hostname or None, if the url is None or invalid
- Return type:
str
- Ref:
- fkie_mas_pylib.system.host.get_local_address() str
- Returns:
default local IP address (e.g. eth0). May be overriden by ROS_IP/ROS_HOSTNAME/__ip/__hostname,
str
- fkie_mas_pylib.system.host.get_local_addresses() List[str]
- Returns:
known local addresses. Not affected by ROS_IP/ROS_HOSTNAME,
[str]
- fkie_mas_pylib.system.host.get_ros_hostname(url: str, host: str = None) str
Returns the host name used in a url, if it is a name. If it is an IP an empty string will be returned.
- Returns:
host or ‘’ if url is an IP or invalid
- Return type:
str
- fkie_mas_pylib.system.host.is_local(hostname: str, wait: bool = True) bool
Test whether the given host name is the name of the local host or not.
- Parameters:
hostname (str) – the name or IP of the host
- Returns:
True if the hostname is local or None
- Return type:
bool
- Raises:
Exception – on errors while resolving host
- fkie_mas_pylib.system.host.ros_host_suffix(hostname: str = '') str
Creates a suffix from hostname. If hostname is empty use the result of :meth:get_host_name().
- fkie_mas_pylib.system.host.subdomain(hostname: str) str | None
- Returns:
the name with first subdomain
- fkie_mas_pylib.system.host.use_ipv6() bool