geotribu_cli.utils.url_helpers module

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

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

geotribu_cli.utils.url_helpers.check_str_is_url(input_str, ref_shemes=('http', 'https'), raise_error=True)

Checks if a given str is a valid URL.

Paramètres:
  • 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.

Renvoie:

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

Type renvoyé:

bool

Lève:
  • 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.