def download_gallery_images(url): if web.get_host(url) != FUSKATOR: print >>sys.stderr, "# warning: the site {site} is not supported.".format(site=web.get_host(url)) return # else, if it's the FUSKATOR site url = url.replace('/full/', '/thumbs/') origin, image_urls = extract_image_urls(url) download(url, origin, image_urls)
def test_get_host(): res = web.get_host('http://projecteuler.net/index.php?section=statistics') assert res == 'projecteuler.net'