This is a simple Python library for dealing with the /etc/network/interfaces file in most Debian based distributions. This is forked from https://github.com/dggreenbaum/debinterface to refactor it and maybe extends it with wpa_supplicant handling
Documentation : http://debinterface.readthedocs.io/en/latest/index.html
Example usage
import debinterface
# Get a collection of objects representing the network adapters.
adapters = debinterface.Interfaces().adapters
# You get a list you can iterare over.
# Each adapter has an 'export()' method that returns a dictionary of its options.
# You can print the name of each adapter as follows:
for adapter in adapters:
item = adapter.export()
print(item['name'])
# Write your new interfaces file as follows:
# Any changes made with setter methods will be reflected with the new write.
interfaces = debinterface.Interfaces()
interfaces.writeInterfaces()
# A backup of your old interfaces file will be generated when writing over the previous interfaces file
# By defaults these paths are used :
# INTERFACES_PATH='/etc/network/interfaces'
# BACKUP_PATH='/etc/network/interfaces.old'
# Paths can be customized when instanciating the Interfaces class:
interfaces = debinterface.Interfaces(interfaces_path='/home/interfaces', backup_path='/another/custom/path')
# By defaults, interfaces file is read when instanciating the Interfaces class, to do it lazyly:
interfaces = debinterface.Interfaces(update_adapters=False)
interfaces.updateAdapters()
Run the tests
pip install -r requirements_dev.txt
py.test --cov=debinterface test
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file debinterface-3.2.1.tar.gz.
File metadata
- Download URL: debinterface-3.2.1.tar.gz
- Upload date:
- Size: 422.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b17c47e57b2ec31f9fa99c73a3bc0005f79f936433a42236fa7987d29b3330eb
|
|
| MD5 |
dbee28e20dc227646e5a044c21face2d
|
|
| BLAKE2b-256 |
28ec95da62d929bfbeea2292fe613a411b6dd580210de5c728f4c4f6a30ff21a
|
File details
Details for the file debinterface-3.2.1-py2-none-any.whl.
File metadata
- Download URL: debinterface-3.2.1-py2-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29b7a21de568be717f46ee6462aea1cea3493ecd136dc68b608e59df1e5f8e00
|
|
| MD5 |
5dde95cda53c8d1528f7a418ff9d59bf
|
|
| BLAKE2b-256 |
310802eda327117c30b5d3b31a3346b6bc0579ea57df4fd59b359da231768c1b
|