Skip to main content
Pydantic Docs
current

Search documentation

Type to search this documentation.

On this pageOverview

Mac Address

The MAC address module provides functionality to parse and validate MAC addresses in different formats, such as IEEE 802 MAC-48, EUI-48, EUI-64, or a 20-octet format.

Bases: str

Represents a MAC address and provides methods for conversion, validation, and serialization.

Python
from pydantic import BaseModel

from pydantic_extra_types.mac_address import MacAddress

class Network(BaseModel):
    mac_address: MacAddress

network = Network(mac_address='00:00:5e:00:53:01')
print(network)
# > mac_address='00:00:5e:00:53:01'

@staticmethod

Python
def validate_mac_address(value: bytes) -> str

Validate a MAC Address from the provided byte value.

str

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu