Python Ping module that works in Windows. Hallelujia! The usual way of pinging from Python in Windows is to parse the output of ping.exe, which is super slow and doesn't exit gracefully. I adapted some code I found here to an importable module.
Copy it anywhere in your Python path.
from pinger import ping
ping_time = ping("google.com")
If left unspecified the timeout is 10 seconds, but you can specify whatever you want. Here's 5 seconds:
ping_time = ping("google.com", 5)
Here's how to translate the ping time to milliseconds like good 'ol ping.exe:
ping_time = int( round(ping_time, 3) * 1000 )