is_url_connectable

pyhelpers.ops.is_url_connectable(url)[source]

Check whether the current machine can connect to a given URL.

Parameters:

url (str) – a (valid) URL

Returns:

whether the machine can currently connect to the given URL

Return type:

bool

Examples:

>>> from pyhelpers.ops import is_url_connectable

>>> url_0 = 'https://www.python.org/'
>>> is_url_connectable(url_0)
True

>>> url_1 = 'https://www.python.org1/'
>>> is_url_connectable(url_1)
False