def get_thumbnail_of_file(image_name, width):
    """Return the file contents of the thumbnail of the given file."""
    hdr = {'User-Agent': 'Python urllib2'}
    url = make_thumb_url(image_name, width)
    req = urllib2.Request(url, headers=hdr)
    try:
        logging.debug("Retrieving %s", url)
        opened = urllib2.urlopen(req)
        extension = opened.headers.subtype
        return opened.read(), make_thumbnail_name(image_name, extension)
    except urllib2.HTTPError, e:
        message = e.fp.read()
        raise get_exception_based_on_api_message(message, image_name)
def get_thumbnail_of_file ( image_name , width ) : hdr = { 'User-Agent' : 'Python urllib2' } url = make_thumb_url ( image_name , width ) req = urllib2 . Request ( url , headers = hdr ) try : logging . debug ( "Retrieving %s" , url ) opened = urllib2 . urlopen ( req ) extension = opened . headers . subtype return opened . read ( ) , make_thumbnail_name ( image_name , extension ) except urllib2 . HTTPError , e : message = e . fp . read ( ) raise get_exception_based_on_api_message ( message , image_name )
Return the file contents of the thumbnail of the given file.