(domain, workingdir, local_dir, resource_path)
fetch resource described in appcache manifest
fetch resource described in appcache manifest
fetch resource described in appcache manifest
def fetch_resource(domain, workingdir, local_dir, resource_path):
    """
    fetch resource described in appcache manifest
    """
    try:
        url, path = get_resource_path_and_url(domain, workingdir, resource_path)
        # create directories if not exist
        local_resource_path = ''.join([local_dir, path])
        local_resource_dir = os.path.dirname(local_resource_path)
        if not os.path.exists(local_resource_dir):
            os.makedirs(local_resource_dir)

        (_filename, _headers) = retrieve_from_url(url, local_resource_path)
        # I need to save the header at some place so they can be written (and processed at install time)
        return (path.lstrip('/'), _headers)
    except IOError as e:
        logger.info('IO failed ', e)
    except urllib.URLError as e:
        logger.info('fetch failed ', e)
def fetch_resource ( domain , workingdir , local_dir , resource_path ) : try : url , path = get_resource_path_and_url ( domain , workingdir , resource_path ) # create directories if not exist local_resource_path = '' . join ( [ local_dir , path ] ) local_resource_dir = os . path . dirname ( local_resource_path ) if not os . path . exists ( local_resource_dir ) : os . makedirs ( local_resource_dir ) ( _filename , _headers ) = retrieve_from_url ( url , local_resource_path ) # I need to save the header at some place so they can be written (and processed at install time) return ( path . lstrip ( '/' ) , _headers ) except IOError as e : logger . info ( 'IO failed ' , e ) except urllib . URLError as e : logger . info ( 'fetch failed ' , e )