How can I get a list of the IP addresses or host names from a local network easily in Python?
It would be best if it was multi-platform, but it needs to work on Mac
If by "local" you mean on the same network segment, then you have to perform the following steps:
Or you can just let Python execute nmap externally and pipe the results back into your program.
Here is a small tool scanip that will help you to get all ip addresses and their corresponding mac addresses in the network (Works on Linux).
https://github.com/vivkv/scanip
One of the answers in this question might help you. There seems to be a platform agnostic version for python, but I haven't tried it yet.
Try:
import socket
print ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1])