print_connection_warning¶
- pyrcs.utils.print_connection_warning(verbose=False)[source]¶
Checks the Internet connection and prints a warning if the source is unreachable.
This function attempts to connect to the source homepage of Railway Codes. If the connection fails and
verboseisTrue, it alerts the user that the instance will rely on local backup data.- Parameters:
verbose (bool | int) – Whether to print the warning message; defaults to
False.
Examples:
>>> from pyrcs.utils import print_connection_warning >>> # If the website is reachable, nothing is printed: >>> print_connection_warning(verbose=True) >>> # If the website is unreachable, a warning is printed: >>> print_connection_warning(verbose=True) Failed to establish an Internet connection. The current instance relies on local backup.