Skip to main content

No project description provided

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 but 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

The following section is taken from the origin netifaces:

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.

4. Platform support

For now, I target Linux and MacOS, with Windows support expected in version >=2.0.0. The minimum python version you can use is Python 3.5. The linux target for python is manylinux2014.

5. License

This software is distributed under a MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netifaces2-0.0.12.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distributions

netifaces2-0.0.12-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

netifaces2-0.0.12-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

netifaces2-0.0.12-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

netifaces2-0.0.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

netifaces2-0.0.12-cp310-none-win_amd64.whl (119.3 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

netifaces2-0.0.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

netifaces2-0.0.12-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (471.7 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

netifaces2-0.0.12-cp39-none-win_amd64.whl (119.3 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

netifaces2-0.0.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

netifaces2-0.0.12-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (471.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

netifaces2-0.0.12-cp38-none-win_amd64.whl (119.2 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

netifaces2-0.0.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

netifaces2-0.0.12-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (471.9 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

netifaces2-0.0.12-cp37-none-win_amd64.whl (119.2 kB view hashes)

Uploaded CPython 3.7 Windows x86-64

netifaces2-0.0.12-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

netifaces2-0.0.12-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (471.9 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page