pydantic.networks
The networks module contains types for common network-related fields.
Validate email addresses.
Validate an IPv4 or IPv6 address.
Validate an IPv4 or IPv6 interface.
Validate an IPv4 or IPv6 network.
Bases: Representation
Validate a name and email address combination.
The name.
The email address.
Bases: PydanticMetadata
Url constraints.
The maximum length of the url. Defaults to None.
Type: int | None
The allowed schemes. Defaults to None.
Type: list[str] | None
Whether the host is required. Defaults to None.
Type: bool | None
The default host. Defaults to None.
Type: str | None
The default port. Defaults to None.
Type: int | None
The default path. Defaults to None.
Type: str | None
def validate_email(value: str) -> tuple[str, str]
Email address validation using https://pypi.org/project/email-validator/.
tuple[str, str]
A type that will accept any AMQP DSN.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['amqp', 'amqps'])]
A type that will accept any http or https URL.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['http', 'https'])]
Base type for all URLs.
Default: Url
A type that will accept any Cockroach DSN.
Default: Annotated[Url, UrlConstraints(host_required=True, allowed_schemes=['cockroachdb', 'cockroachdb+psycopg2', 'cockroachdb+asyncpg'])]
A type that will accept any file URL.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['file'])]
A type that will accept any http or https URL with a max length of 2083 characters.
Default: Annotated[Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'])]
A type that will accept any Kafka DSN.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['kafka'], default_host='localhost', default_port=9092)]
A type that will accept any MariaDB DSN.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['mariadb', 'mariadb+mariadbconnector', 'mariadb+pymysql'], default_port=3306)]
A type that will accept any MongoDB DSN.
Default: Annotated[MultiHostUrl, UrlConstraints(allowed_schemes=['mongodb', 'mongodb+srv'], default_port=27017)]
A type that will accept any MySQL DSN.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['mysql', 'mysql+mysqlconnector', 'mysql+aiomysql', 'mysql+asyncmy', 'mysql+mysqldb', 'mysql+pymysql', 'mysql+cymysql', 'mysql+pyodbc'], default_port=3306)]
A type that will accept any Postgres DSN.
Default: Annotated[MultiHostUrl, UrlConstraints(host_required=True, allowed_schemes=['postgres', 'postgresql', 'postgresql+asyncpg', 'postgresql+pg8000', 'postgresql+psycopg', 'postgresql+psycopg2', 'postgresql+psycopg2cffi', 'postgresql+py-postgresql', 'postgresql+pygresql'])]
A type that will accept any Redis DSN.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['redis', 'rediss'], default_host='localhost', default_port=6379, default_path='/0')]