macaddr
As a network engineer you many have to deal with MAC address values. In some cases a network operating system wants the MAC address in a particular format. The following are common formats:
* aa:bb:cc:dd:ee:ff
* aabb-ccdd-eeff
* aabb.ccdd.eeff
As well as their upper-case variants, AA:BB:CC:DD:EE:FF for example.
This package provides the MacAddress class definition and a supporting format
method that allows you to develop programs using a MAC address in different formats.
Installation
pip install macaddr
Usage
By default the MacAddress is formated in the "2 byte colon separated" format.
from macaddr import MacAddress
mac = MacAddress("aabb.ccdd.eeff")
print(mac)
aa:bb:cc:dd:ee:ff
You can obtain differnt formats using the format method.
from macaddr import MacAddress
mac = MacAddress("aabb.ccdd.eeff")
print(mac.format(size=4, sep='-', to_case=str.upper))
AABB-CCDD-EEFF
The format method values are cached so that repeated calls to format with
the same arguments return the cached value. For example, if you had a network
of 1000 devices, 500 of them required the "2-colon" format and 500 of them
required the "4-dot" format, then these two formats are only computed twice.
Metadata
Release files for macaddr 2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| macaddr-2.1.tar.gz | 7.5 kB | Without provenance | Details for macaddr-2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| macaddr-2.1-py3-none-any.whl | Python 3 | none | any | Details for macaddr-2.1-py3-none-any.whl |
Total release size: 15.0 kB
Release files / macaddr-2.1.tar.gz
| Download URL | macaddr-2.1.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07bb34404774719284b336c8d920ec29a49c948e2351ed357d6ed64e2533ae90
|
|
BLAKE2b-256 checksum How to use checksums |
5cf9264e433ffd3046106be8fd953fc86237b87e7da9c5622bf7c188b9ffd66d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|
Release files / macaddr-2.1-py3-none-any.whl
| Download URL | macaddr-2.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98ef79bf0b451114f76b7e329bbdd134a6b2ca63d6e5aae72f990ea2a33d80c3
|
|
BLAKE2b-256 checksum How to use checksums |
af0739cd975abb97f8bdcc68fd22dfc094db444946e7593976beb92bca8d11b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|
Security for macaddr 2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.