Utils
- class streamlit_pyvista.helpers.utils.ServerItem(host, type=None, path=None)[source]
Bases:
objectA class used to represent servers that managers instantiate
Attributes: host (str): The host of the server. type (str): The type of the server. Default is None. path (str): The path of the server. Default is None.
-
host:
str
-
type:
str= None
-
path:
str= None
- __init__(host, type=None, path=None)
-
host:
- streamlit_pyvista.helpers.utils.is_localhost(url)[source]
Check if the url is localhost or is remote :type url:
str:param url: the url to check :type url: str- Returns:
True if the url is a localhost url, False otherwise
- Return type:
bool
- streamlit_pyvista.helpers.utils.replace_host(url, new_host)[source]
Replace the host in a given URL with a new host.
- Parameters:
url (str) – The original URL.
new_host (str) – The new host to replace the old host.
- Returns:
The URL with the host replaced.
- Return type:
str
- streamlit_pyvista.helpers.utils.is_web_link(string)[source]
Check if the input is a link :type string:
str:param string: string to check :type string: str- Returns:
True if the string is a url, False otherwise
- Return type:
bool
- streamlit_pyvista.helpers.utils.find_free_port()[source]
Find a free port on the local machine
- Returns:
A free port
- Return type:
int
- streamlit_pyvista.helpers.utils.is_free_port(port, host='localhost')[source]
Check if a given port is free or not
- Parameters:
port (int) – The port to check.
host (str) – The host. By default, “localhost”.
- Returns:
True if the port is free, False otherwise.
- Return type:
bool
- streamlit_pyvista.helpers.utils.is_server_available(server)[source]
Check if the server is available by checking if the number of clients connected to the server is 0
- Parameters:
server (ServerItem) – The server to check
- Returns:
True if the server is available, False otherwise
- Return type:
bool
- streamlit_pyvista.helpers.utils.is_server_alive(server_url, timeout=0.5)[source]
Check if the server is alive by making a request to the server
- Parameters:
server_url (ServerItem) – The server to check
timeout (float) – The timeout for the request. Default is 0.5.
- Returns:
True if the server is alive, False otherwise
- Return type:
bool