使用python flask进行统一资源标识符验证

时间:2019-07-06 22:33:24

标签: python flask

我对Flask很陌生,我想知道如何正确验证Flask中的统一资源标识符。

email = EmailField('Email Address', validators=[DataRequired()])
#this is not enough validation for url
url = EmailField('Uniform Resource Identifier', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired(), Email()])

1 个答案:

答案 0 :(得分:0)

就像DataRequiredEmail是内置验证器一样,FlaskWTForms也有内置URL validator

url = StringField('Uniform Resource Identifier', validators=[URL()]