drytoml.types module¶
Custom types and synonyms.
-
class
drytoml.types.
Url
(string)¶ Bases:
str
Avoid instantiation for non-compliant url strings.
-
URL_VALIDATOR
= re.compile('^(?:http|ftp)s?://(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+(?:[A-Z]{2,6}\\.?|[A-Z0-9-]{2,}\\.?)|localhost|\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})(?::\\d+)?(?:/?|[/?]\\S+)$', re.IGNORECASE)¶ Django validator.
-
classmethod
validate
(maybe_url) → bool¶ Validate url string using django regex.
- Parameters
maybe_url – Url to validate.
- Returns
True iff validation succeeds.
-