watex.utils.funcutils.url_checker#

watex.utils.funcutils.url_checker(url, install=False, raises='ignore')[source]#

check whether the URL is reachable or not.

function uses the requests library. If not install, set the install parameter to True to subprocess install it.

Parameters:
  • url (str,) – link to the url for checker whether it is reachable

  • install (bool,) – Action to install the ‘requests’ module if module is not install yet.

  • raises (str) – raise errors when url is not recheable rather than returning 0. if raises is ignore, and module ‘requests’ is not installed, it will use the django url validator. However, the latter only assert whether url is right but not validate its reachability.

Return type:

``True``{1} for reacheable and ``False``{0} otherwise.

Example

>>> from watex.utils.funcutils import url_checker
>>> url_checker ("http://www.example.com")
...  0 # not reacheable
>>> url_checker ("https://watex.readthedocs.io/en/latest/api/watex.html")
... 1