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.
MacAddress ¶
Bases: str
Represents a MAC address and provides methods for conversion, validation, and serialization.
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'
validate_mac_address
staticmethod
¶
validate_mac_address(value)
Validate a MAC Address from the provided byte value.
Source code in pydantic_extra_types/mac_address.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|