Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
75 views
in Technique[技术] by (71.8m points)

python - Pythonic Way of Getting Network Interfaces and Submitting Configuration Changes

I need to programmatically manipulate Linux host device IP addresses. I have not found any Python libraries that provide this functionality. I think that what I'm after may be provided in the ip CLI tool, but am hoping for a Pythonic solution not involving subprocess.

This is not a web scraping issue, so I am not looking for proxy-related solutions.

The use-case is providing a web interface on a Raspberry Pi from within a Docker container so that the user can set the device's IP address in a simple HTML form.

question from:https://stackoverflow.com/questions/66052579/pythonic-way-of-getting-network-interfaces-and-submitting-configuration-changes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The py-ip-command might help you. It allows you run the command and get the output as a pythonic object, that can be easily accessed. You can find it on PyPi: https://pypi.org/project/py-ip-command/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...