this is the python script i used to capture photo from webcam logitech c170 in raspberry pi
import time
import datetime
from subprocess import call
now = datetime.datetime.now()
call(["fswebcam","-p","YUYV","-d","/dev/video0","-r","640x480","--no-banner","/home/pi/pictures/%s.jpg" % now])
time.sleep(1)