In [10]:
import requests
from bs4 import BeautifulSoup
import re
import os

In [11]:
r = requests.get("http://pythonforengineers.com/pythonforengineersbook/")
data = r.text
soup = BeautifulSoup(data)

In [12]:
for link in soup.find_all('img'):
    print link.get("src")
    
    image = link.get("src")
    try:
        r2 = requests.get(image)

        basename, filename = os.path.split(image)

        with open(filename, "wb") as out_file:
            out_file.write(r2.content)
    except:
        pass


http://pythonforengineers.com/wp-content/uploads/2014/07/Python_for_Scientists-small-200x300.jpg
http://pythonforengineers.com/wp-content/uploads/2014/07/abba_face_detected-300x277.jpg
http://pythonforengineers.com/wp-content/uploads/2014/07/motion2-150x150.jpg
http://pythonforengineers.com/wp-content/uploads/2014/07/noisy4.png
http://pythonforengineers.com/wp-content/uploads/2014/07/audacity3.jpg
http://pythonforengineers.com/wp-content/uploads/2014/07/Marvin_HHGG.jpg
http://pythonforengineers.com/wp-content/uploads/2014/07/300px-RaspberryPi.jpg
http://pythonforengineers.com/wp-content/uploads/2014/07/rpi.jpg
//in.getclicky.com/100746374ns.gif

In [12]: