Python marshmallow.fields.Email() Examples
The following are 4
code examples of marshmallow.fields.Email().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
marshmallow.fields
, or try the search function
.
Example #1
Source File: test_errors.py From flask-rebar with MIT License | 9 votes |
def create_app(self): app = Flask(__name__) Rebar().init_app(app=app) class NestedSchema(validation.RequestSchema): baz = fields.List(fields.Integer()) class Schema(validation.RequestSchema): foo = fields.Integer(required=True) bar = fields.Email() nested = fields.Nested(NestedSchema) @app.route("/stuffs", methods=["POST"]) def json_body_handler(): data = get_json_body_params_or_400(schema=Schema) return response(data) return app
Example #2
Source File: test_marshmallow.py From pydantic with MIT License | 6 votes |
def __init__(self, allow_extra): class LocationSchema(Schema): latitude = fields.Float(allow_none=True) longitude = fields.Float(allow_none=True) class SkillSchema(Schema): subject = fields.Str(required=True) subject_id = fields.Integer(required=True) category = fields.Str(required=True) qual_level = fields.Str(required=True) qual_level_id = fields.Integer(required=True) qual_level_ranking = fields.Float(default=0) class Model(Schema): id = fields.Integer(required=True) client_name = fields.Str(validate=validate.Length(max=255), required=True) sort_index = fields.Float(required=True) # client_email = fields.Email() client_phone = fields.Str(validate=validate.Length(max=255), allow_none=True) location = fields.Nested(LocationSchema) contractor = fields.Integer(validate=validate.Range(min=0), allow_none=True) upstream_http_referrer = fields.Str(validate=validate.Length(max=1023), allow_none=True) grecaptcha_response = fields.Str(validate=validate.Length(min=20, max=1000), required=True) last_updated = fields.DateTime(allow_none=True) skills = fields.Nested(SkillSchema, many=True) self.allow_extra = allow_extra # unused self.schema = Model()
Example #3
Source File: utils_test.py From flask_accepts with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_ma_field_to_reqparse_argument_single_values(): # Test a simple integer. result = utils.ma_field_to_reqparse_argument(ma.Integer(required=True)) assert result["type"] is int assert result["required"] is True assert result["action"] == "store" assert "help" not in result # Test that complex fields default to string. result = utils.ma_field_to_reqparse_argument(ma.Email(required=True, description="A description")) assert result["type"] is str assert result["required"] is True assert result["action"] == "store" assert result["help"] == "A description"
Example #4
Source File: shapes.py From marshmallow-polyfield with Apache License 2.0 | 5 votes |
def fuzzy_schema_deserialization_disambiguation(data, _): if isinstance(data, dict): return ShapeSchema if isinstance(data, str): return fields.Email raise TypeError('Could not detect type. ' 'Are you sure this is a shape or an email?')