mirror of
https://github.com/rjNemo/fastapi
synced 2026-06-12 05:26:45 +00:00
🐛 Fix import of email_validator from Pydantic
This commit is contained in:
parent
da166b7967
commit
b763a44328
2 changed files with 4 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
|
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
|
||||||
|
|
||||||
__version__ = "0.1.3"
|
__version__ = "0.1.4"
|
||||||
|
|
||||||
from .applications import FastAPI
|
from .applications import FastAPI
|
||||||
from .routing import APIRouter
|
from .routing import APIRouter
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@ from pydantic import BaseModel, Schema as PSchema
|
||||||
from pydantic.types import UrlStr
|
from pydantic.types import UrlStr
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pydantic.types.EmailStr
|
import email_validator
|
||||||
from pydantic.types import EmailStr # type: ignore
|
from pydantic.types import EmailStr # type: ignore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logging.warning(
|
logging.warning(
|
||||||
"email-validator not installed, email fields will be treated as str"
|
"email-validator not installed, email fields will be treated as str.\n" +
|
||||||
|
"To install, run: pip install email-validator"
|
||||||
)
|
)
|
||||||
|
|
||||||
class EmailStr(str): # type: ignore
|
class EmailStr(str): # type: ignore
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue