Is it possible in python to kill a process that is listening on a specific port, say for example 8080?
I can do netstat -ltnp | grep 8080 and kill -9 <pid> OR execute a shell command from python but I wonder if there is already some module that contains API to kill process by port or name?
First of all, processes don't run on ports - processes can bind to specific ports. A specific port/IP combination can only be bound to by a single process at a given point in time.
As Toote says, psutil gives you the netstat functionality. You can also use os.kill to send the kill signal (or do it Toote's way).
Is it possible in python to kill process that is listening on specific port, for example 8080?