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

Categories

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

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

1 Answer

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/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...