Python Forum
a function to get IP addresses of interfaces - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: a function to get IP addresses of interfaces (/thread-37345.html)



a function to get IP addresses of interfaces - Skaperen - May-30-2022

i am looking around for a function that can return IP addresses of named interfaces, supporting both IPv4 and IPv6. a function that can return a list of interface names is a plus.


RE: a function to get IP addresses of interfaces - bowlofred - May-30-2022

Could see if netifaces module would work for you.


RE: a function to get IP addresses of interfaces - Skaperen - May-30-2022

(May-30-2022, 07:22 AM)bowlofred Wrote: Could see if netifaces module would work for you.
it looks like it should work. it would be better than running the "ip" command in Linux and parsing its output. that, plus it is a small implementation in C that could help me learn the basics of using C within Python.