def head_resource(uri): '''Get the metadata on a resource. ARGS: @uri -- The uri for locating the resource in relation to the resources directory. Ex networks/config. RETURNS: @metadata -- The metadata associated with the uri given. ''' from find_resource import find_resource path = find_resource(uri) return the meta data when we figure out how this will be structured
def delete_resource(uri): '''Delete a resource. ARGS: @uri -- The uri for locating the resource in relation to the resources directory. Ex networks/config. RETURNS: None ''' import os from find_resource import find_resource path = find_resource(uri) os.remove(path)
def get_resource(uri): '''Open the resource, read and return its data. ARGS: @uri -- The uri for locating the resource in relation to the resources directory. Ex networks/config. RETURNS: @data -- The data contained in the file as a String. ''' from find_resource import find_resource path = find_resource(uri) with open(path, 'r') as resource: return resource.read()