def resolve_one_media(file_id, resource):
 _file = app.media.get(file_id, resource)
 if _file:
  if config.RETURN_MEDIA_AS_BASE64_STRING:
   ret_file = base64.encodestring(_file.read())
  elif config.RETURN_MEDIA_AS_URL:
   prefix = (config.MEDIA_BASE_URL if (config.MEDIA_BASE_URL is not None) else app.api_prefix)
   ret_file = ('%s/%s/%s' % (prefix, config.MEDIA_ENDPOINT, file_id))
  else:
   ret_file = None
  if config.EXTENDED_MEDIA_INFO:
   ret = {'file': ret_file}
   for attribute in config.EXTENDED_MEDIA_INFO:
    if hasattr(_file, attribute):
     ret.update({attribute: getattr(_file, attribute)})
    else:
     abort(500, description=debug_error_message('Invalid extended media attribute requested'))
   return ret
  else:
   return ret_file
 else:
  return None

def resolve_one_media ( file_id , resource ) : _file = app . media . get ( file_id , resource ) if _file : if config . RETURN_MEDIA_AS_BASE64_STRING : ret_file = base64 . encodestring ( _file . read ( ) ) elif config . RETURN_MEDIA_AS_URL : prefix = ( config . MEDIA_BASE_URL if ( config . MEDIA_BASE_URL is not None ) else app . api_prefix ) ret_file = ( '%s/%s/%s' % ( prefix , config . MEDIA_ENDPOINT , file_id ) ) else : ret_file = None if config . EXTENDED_MEDIA_INFO : ret = { 'file' : ret_file } for attribute in config . EXTENDED_MEDIA_INFO : if hasattr ( _file , attribute ) : ret . update ( { attribute : getattr ( _file , attribute ) } ) else : abort ( 500 , description = debug_error_message ( 'Invalid extended media attribute requested' ) ) return ret else : return ret_file else : return None
get response for one media file .