@ -209,7 +209,7 @@ class CreateWatch(Resource):
json_data = request.get_json()
url = json_data['url'].strip()
if not validators.url(json_data['url'].strip()):
if not validators.url(url, simple_host=True):
return "Invalid or unsupported URL", 400
if json_data.get('proxy'):
@ -259,7 +259,7 @@ class validateURL(object):
import validators
try:
validators.url(field.data.strip())
validators.url(field.data.strip(), simple_host=True)
except validators.ValidationFailure:
message = field.gettext('\'%s\' is not a valid URL.' % (field.data.strip()))
raise ValidationError(message)
@ -10,7 +10,8 @@ flask~=2.0
inscriptis~=2.2
pytz
timeago~=1.0
validators
validators==0.21.2
# Set these versions together to avoid a RequestsDependencyWarning
# >= 2.26 also adds Brotli support if brotli is installed