Hosting a html page of images on localhost and excessing it through web crawler, and downloading the image
<p>I had created a web crawler in python that access the web page &amp; downloads image from that page.The code of web crawler is -</p>

<blockquote>
  <h1>ImageDownloader.py</h1>
  
  <h1>Finds and downloads all images from any given URL.</h1>
  
  <p>import urllib2 </p>
  
  <p>import re from os.path</p>
  
  <p>import basename from urlparse </p>
  
  <p>import urlsplit</p>
  
  <p>url = "http://www.yahoo.com"</p>
  
  <p>urlContent = urllib2.urlopen(url).read()</p>
  
  <h1>HTML image tag: </h1>
  
  <p>imgUrls = re.findall('img.<em>?src="(.</em>?)"', urlContent)</p>
  
  <h1>download all images</h1>
  
  <p>for imgUrl in imgUrls:</p>

<pre><code>try:
    imgData = urllib2.urlopen(imgUrl).read()
    fileName = basename(urlsplit(imgUrl)[2])
    output = open(fileName,'wb')
    output.write(imgData)
    output.close()
except:
    pass
</code></pre>
</blockquote>

<p>but i have to show a demo in class..So i biulted a simple web page with some images &amp; hosted it on localhost but the web crawler which i have created is not accessing the html page and not downloading the images...
Can anyone help me out in accessing the html page on localhost from the crawler</p>
