Selecting edges by mouse from script - beginner needs help

Is it possible to select edges with a mouse click from inside the script and if so, what is the best way to do this?