---
title: "💭 Network Types - Pydantic"
description: "!https://docs.pydantic.dev/2.7/api/networks/#pydantic.networks.EmailStr"
date: 2024-04-30
published: true
tags:
  - thought
template: link
---


![https://docs.pydantic.dev/2.7/api/networks/<a href="/tags/pydantic/" class="hashtag-tag" data-tag="pydantic" data-count=3 data-reading-time=3 data-reading-time-text="3 minutes">#pydantic</a>.networks.EmailStr](/static/https://docs.pydantic.dev/2.7/api/networks/<a href="/tags/pydantic/" class="hashtag-tag" data-tag="pydantic" data-count=3 data-reading-time=3 data-reading-time-text="3 minutes">#pydantic</a>.networks.EmailStr)

pydantic has a nice built in email validator `EmailStr`

It requires an optional pydantic dependency 

``` bash
pip install email-validator
```

Then you can validate email addresses.

``` python
from pydantic import BaseModel, EmailStr

class Model(BaseModel):
    email: EmailStr

print(Model(email='contact@mail.com'))
#> email='contact@mail.com'
```

!!! note

    This post is a <a href="/thoughts/" class="wikilink" data-title="Thoughts" data-description="These are generally my thoughts on a web page or some sort of url, except a rare few don&#39;t have a link. These are dual published off of my..." data-date="2024-04-01">thought</a>. It's a short note that I make
    about someone else's content online <a href="/tags/thoughts/" class="hashtag-tag" data-tag="thoughts" data-count=2 data-reading-time=3 data-reading-time-text="3 minutes">#thoughts</a>
