I am using fping
program to get network latencies of a list of hosts. Its a shell program but I want to use it in my python script and save the output in some database.
I am using subprocess.call()
like this:
import subprocess
subprocess.call(["fping","-l","google.com"])
The problem with this is its an infinite loop given indicated by -l
flag so it will go on printing the input to the console. But after every output, I need some sort of callback so that I can save it in db. How can I do that?
I looked for subprocess.check_output()
but its not working.