def fetch_hdu(filename, cache=True):
 for retry in range(MAX_RETRIES):
  try:
   path = download_file((URL + filename), cache=cache, timeout=30)
  except:
   if (retry == (MAX_RETRIES - 1)):
    raise
   else:
    time.sleep(TIME_BETWEEN_RETRIES)
  else:
   break
 else:
  raise Exception('Failed to download file {0}'.format(filename))
 return fits.open(path)[0]

def fetch_hdu ( filename , cache = True ) : for retry in range ( MAX_RETRIES ) : try : path = download_file ( ( URL + filename ) , cache = cache , timeout = 30 ) except : if ( retry == ( MAX_RETRIES - 1 ) ) : raise else : time . sleep ( TIME_BETWEEN_RETRIES ) else : break else : raise Exception ( 'Failed to download file {0}' . format ( filename ) ) return fits . open ( path ) [ 0 ]
download a fits file to the cache and open hdu 0 .