Network Types
The networks module contains types for common network-related fields.
Bases: PydanticMetadata
Url constraints.
Type: int | None Default: None
Type: list[str] | None Default: None
Type: bool | None Default: None
Type: str | None Default: None
Type: int | None Default: None
Type: str | None Default: None
Validate email addresses.
Bases: Representation
Validate a name and email address combination.
Default: name
Default: email
Validate an IPv4 or IPv6 address.
def __new__(cls, value: Any) -> IPv4Address | IPv6Address
Validate an IPv4 or IPv6 address.
IPv4Address | IPv6Address
Validate an IPv4 or IPv6 interface.
def __new__(cls, value: NetworkType) -> IPv4Interface | IPv6Interface
Validate an IPv4 or IPv6 interface.
IPv4Interface | IPv6Interface
Validate an IPv4 or IPv6 network.
def __new__(cls, value: NetworkType) -> IPv4Network | IPv6Network
Validate an IPv4 or IPv6 network.
IPv4Network | IPv6Network
def getattr_migration(module: str) -> Callable[[str], Any]
Implement PEP 562 for objects that were either moved or removed on the migration to V2.
Callable[[str], Any] — A callable that will raise an error if the object is not found.
The module name.
def import_email_validator() -> None
None
def validate_email(value: str) -> tuple[str, str]
Email address validation using https://pypi.org/project/email-validator/.
tuple[str, str]
A type alias for a JSON schema value. This is a dictionary of string keys to arbitrary values.
Default: Dict[str, Any]
Type: TypeAlias Default: 'str | bytes | int | tuple[str | bytes | int, str | int]'
Base type for all URLs.
Default: Url
A type that will accept any http or https URL.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['http', 'https'])]
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 file URL.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['file'])]
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 Cockroach DSN.
Default: Annotated[Url, UrlConstraints(host_required=True, allowed_schemes=['cockroachdb', 'cockroachdb+psycopg2', 'cockroachdb+asyncpg'])]
A type that will accept any AMQP DSN.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['amqp', 'amqps'])]
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')]
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 Kafka DSN.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['kafka'], default_host='localhost', default_port=9092)]
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 MariaDB DSN.
Default: Annotated[Url, UrlConstraints(allowed_schemes=['mariadb', 'mariadb+mariadbconnector', 'mariadb+pymysql'], default_port=3306)]
Default: _build_pretty_email_regex()