Portable network interface information
Project description
netifaces (2)
1. What is this?
The original netifaces was abandonned by it's maintainer, leaving us without the option to get network addresses of any kind in Python. Unfortunately, the original sources are more akin to arcane magic, so picking where it's been left off is a difficult task.
I decided to rewrite netifaces
, keeping the almost exact same API and adding the following:
- Support for future python versions
- Type annotations
- Maybe a more "queriable" API in the future
This project aims to be a drop-in replacement for those project who use netifaces
, but I do not
guarantee anything.
1.1 What is not working right-now
- The
gateways
API is only working if your system has a/proc/net/route
file - The
windows
API is non-functional
2. Usage
For now the API is the same as the original netifaces
, so please refer to it.
Install:
pip install netifaces2
Import:
>>> import netifaces
>>> netifaces.interfaces()
...
>>> netifaces.ifaddresses('en0')
...
>>> netifacs.gateways()
...
3. API differences between this and al45tair/netifaces
gateways
The gateways
function does not support indexing through the default
special key. This is because it makes a
sane typing definition difficult to write and be understandable. Instead, if you want the same functionality,
the following is exposed:
>>> netifaces.default_gateway()
...
The result will be the default gateway for each interface type. The result may be an empty dict if no default route is set.
The level of completness differs a little bit with the original version; some address families might not yet
be available and PEER
addresses are not reported for now. If you need a feature, open an issue and I will
do my best to add it.
AF_
Constants
In the previous version of netifaces
the AF_
constants' value were assigned
to be platform independent. This has the nice effect of abstracting the OS when
accessing the information of a network layer. However after consideration, it
does not feel like the right place to provide abstraction. If you update your
project's dependencies to this version of netifaces
, be wary of this change.
For instance, on linux you may need to replace AF_LINK
with AF_PACKET
to get
mac addresses.
In the future, an extra API will allow accessing a specific layer's information by querying for it, without using the platform's constant.
4. Platform support
Wheels
Building Linux, Windows and macOS cp37-abi3 wheels (requires Python 3.7 and newer)
Install using pip:
python -m pip install netifaces2
Linux
Linux cp37-abi3 wheels are built on manylinux2_17 aka manylinux2014 and require pip>=19.3
cp36m-manylinux2_17 wheels are unsupported and are being built only as a fallback
for systems with only Python 3.6 available.
5. License
This software is distributed under a MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for netifaces2-0.0.15-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27910b39ae69543dc5afda2d190b625f10da37a75add3883d452ab52338e08fd |
|
MD5 | 136dfcdfcf214916545b94d38508b1fe |
|
BLAKE2b-256 | 76a7bfb633512f3b78230d525fe19e57e701f52e999d870b3f24faa1f7e04c55 |
Hashes for netifaces2-0.0.15-cp37-abi3-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5875a25a47e2783b7169369a32145740717843461033631d4d2ffcf71f715992 |
|
MD5 | 50e0aa0b292607793aca29e5806bedf6 |
|
BLAKE2b-256 | 6c6f167d4d53968ee1894b6a48a5fb69753d8383238b7fe8c3ed435cd2b90ff5 |
Hashes for netifaces2-0.0.15-cp37-abi3-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4cb9f90e192acd7ff65f61b0fee08cf1965bf655556c0a26bc1a911094400c8 |
|
MD5 | af37cf207d30497eae943ec8d7bf95d4 |
|
BLAKE2b-256 | dcc50a894d0e801549c67573e2c773fc68c5d31151470ebcdad980272abc56e6 |
Hashes for netifaces2-0.0.15-cp37-abi3-musllinux_1_1_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26fcae2a96e4b715699113887b40b74400cdf815efd4e47687903e95da12f19c |
|
MD5 | 9938ddb10f5a103740c0f583952dd851 |
|
BLAKE2b-256 | b731ae54f5350e6555a1cf4aedb07595b123bdfbeb30f2195a89159117d6130f |
Hashes for netifaces2-0.0.15-cp37-abi3-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9e2220cd8e56fb8736fee4ebd36b2056a6947358e9283c64a68e22274b94633 |
|
MD5 | e10f447e8e65d9761cad644028e6c8f1 |
|
BLAKE2b-256 | d90c028234d31976260849d1c53b2ac7edef0288a35f903dee16698cae0be4e6 |
Hashes for netifaces2-0.0.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c67f03e507a1e20b9776c5470bf802637cc3590e070dc698fa33c19e5c6caff3 |
|
MD5 | 02d41b33698d428b38e6f5f62018eccf |
|
BLAKE2b-256 | f1a81781fe7b1faf5fc54c11850e2872e4977aede3dbacb6103d121a4ec0cf92 |
Hashes for netifaces2-0.0.15-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8754341e46628d9aa8ce8c35a94e397a9e5ee3bc8ffb5d6658a8dcc41b7ffa0a |
|
MD5 | 269451b6c5bec5d881f0f34d38b8490f |
|
BLAKE2b-256 | 9aaed39c38079b3edea07261cf4db4c4847f5dc05e8328497971902746056490 |
Hashes for netifaces2-0.0.15-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e56d649cf7d60a083077a5227457b42341b7f1252baf43d381f0bdebb49a36ff |
|
MD5 | c5bf4be8178a0f538698181ce8fc140a |
|
BLAKE2b-256 | d27ea7f8144c46044575e87457ed698236e42325d0052b4999a479732868eb25 |
Hashes for netifaces2-0.0.15-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3a82eba49f82af989392c48bb69d404059f47558133f5333399133eaf3fd2a9 |
|
MD5 | c1c3bdfaf6779bd16294acf79a692857 |
|
BLAKE2b-256 | b7a047953bf3347acfd869ab1c2d4e84892af427229c3c9255bbdcad4b1bc653 |
Hashes for netifaces2-0.0.15-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d145c39a40e85d67be72eea6a2d94a8bd2486e52d623f1780536903f8643d6b |
|
MD5 | 88e29fe476d36dd44d9c102971228ed8 |
|
BLAKE2b-256 | 859cc890baf1aee10ac00d2733f4a178753ac4e0ed407300f6746b66f49cd164 |
Hashes for netifaces2-0.0.15-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3de580fd556e7b326abc9a0009153f3663ee51ffff81f6ca1820e766afcaded6 |
|
MD5 | 9e8a8ef5e183c6ef9c625f2f2d12bd22 |
|
BLAKE2b-256 | 82e1555785f2a3cf5d2b380e6836cc270ec10a76f40817085fd1b446d02cd921 |
Hashes for netifaces2-0.0.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63c7807b5917fae181ff97c63f49f31527e5773621c1adf664bbffc7d427bbe3 |
|
MD5 | d472ca45730344177cf761604693efc0 |
|
BLAKE2b-256 | f74689a824dfdb13ae909d0e2c5bdcaaeaa2640ebba06cf07761ed078c64f5a3 |
Hashes for netifaces2-0.0.15-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7112d0fdb99a31ffa79a6d094c6e05bcd29045e38aebf41eb4e77df90a7c601 |
|
MD5 | 0815c2c190dfa7f548d51c26b735385a |
|
BLAKE2b-256 | 96063fd42b624140aee362c3e619520919242d65076e5e17bb6251137640dbcc |
Hashes for netifaces2-0.0.15-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a204466d011360f8f4dca691c8dd4e05c215b70e7d0c60580d87e7fe89a43252 |
|
MD5 | dfaead2aa6440e990d2d6b1602e9dddf |
|
BLAKE2b-256 | 541772968957659e92b69acb9cf3661c2e296b13de45b76aa6ddbe1aa7b1606c |
Hashes for netifaces2-0.0.15-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09c2c524fa4e12d101ff1448572a6ec4f3583e468cae6a24986d8b3e71de12ae |
|
MD5 | f29a0b625d10d18c88034012edf4eb4b |
|
BLAKE2b-256 | ecf07bb41c529fd1d3f399ab95e5e326e91571ebed86264a16e72ea9a14c4a45 |
Hashes for netifaces2-0.0.15-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38f2a5e809221de908ae4bc6cba99874a9f793911fa6312a95245fa275f48764 |
|
MD5 | 05a63930b081cc125dbf250cbdfca24c |
|
BLAKE2b-256 | 94b9e068d62620f20581134bda3ff630d86bd3697a9c690e2c83e9a0b725f084 |
Hashes for netifaces2-0.0.15-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a79fa59e5f77821e966b376ee5f3c1cace8b429ddfa4ba45ccb1e5df22aec215 |
|
MD5 | d0a6755ffcb0060afc5735c0b4da0e2d |
|
BLAKE2b-256 | c89f8be49316c7851920ae31e955713832e9ea3d68cf195db3c9f3aa5a6279a7 |