If you want to get the IP address of the host on which the python script is running, then the answer provided by user2096338 is the way to go.
In order to discover all the computers on a network within a LAN you can use scapy. https://github.com/bwaldvogel/neighbourhood/blob/master/neighbourhood.py is a link that I found while browsing a similar SO question; which discovers all computers within a network (LAN).
If you want to ensure that the above script returns only those computers that are running your server - then there are multiple ways to do so, listed below in order of portablility
- Whenever you install your server on a host, then register itself into a central database which can then be queried by a new instance of your service to identify all computers where the peer servers are running
- Use WMI (since you are on Windows) to query all processes running on the peer system anc check if your server process is one amongst them.
- Your server will keep a probing port open and a new server installation will ping to the server on this probing port for each of the hosts in the network. If it gets a response, then this computer is running the server process.
In my opinion, method 1 is the safest and portable, since it prevents the opening up of unnecessary ports( like method 3) which are security holes (depending on whose context your python script runs). It also does not depend on the availability of the WMI service on the remote hosts ( some systems may have WMI disabled).
Hope this helps