qgis_deployment_toolbelt.utils.url_helpers module#

Helpers to check file: readable, exists, etc..

Author: Julien Moura (https://github.com/guts)

qgis_deployment_toolbelt.utils.url_helpers.check_str_is_url(input_str: str, ref_shemes: tuple = ('http', 'https'), raise_error: bool = True)#

Checks if a given str is a valid URL.

Parameters:
  • input_str (str) – The input str to check.

  • ref_schemes (tuple, optional) – The reference schemes for valid URLs. By default, it includes (“http”, “https”).

  • raise_error (bool, optional) – Indicates whether an exception should be raised for invalid str. Default is True.

Returns:

True if the str is a valid URL, False otherwise.

Return type:

bool

Raises:
  • ValueError – If the str is not a valid URL and raise_error is True.

  • TypeError – If an error occurs during str checking and raise_error is True.