hstools

hstools.auth

This is a test

basic_authorization

basic_authorization(authfile='~/.hs_auth_basic')

performs basic HS authorization using username and password stored in ~/.hs_auth_basic file in the following format (b64 encoded):

{ "usr": "" "pwd": "" }

Returns hs_restclient instance or None

oauth2_authorization

oauth2_authorization(authfile='~/.hs_auth')

performs HS authorization using OAuth2 credentials stored in ~/.hs_auth file, in a pickled binary format.

Returns hs_restclient instance or None

hstools.compat

hstools.log

hstools.resource

hstools.threads

hstools.funcs

hstools.funcs.delete

hstools.funcs.describe

hstools.funcs.add

hstools.funcs.create

hstools.funcs.ls

hstools.funcs.content

hstools.funcs.init

hstools.funcs.get

hstools.progress

hstools.utilities

get_server_url_for_path

get_server_url_for_path(p)

gets the url corresponding to a given file or directory path p : path to convert into a url

returns the url path for the filepath p

get_relative_path

get_relative_path(p)

gets the path relative to the jupyter home directory p: path to convert into relative path

returns the path relative to the default jupyter home directory

hstools.hydroshare

hydroshare Objects

class hydroshare()

__init__

 | __init__(save_dir=None, authfile='~/.hs_auth')

save_dir is the location that data will hs resources will be saved.

close

 | close()

closes the connection to HydroShare

deleteResource

 | deleteResource(resid)

Deletes a hydroshare resource

args: -- resid: hydroshare resource id

returns: -- True if successful, else False

getResourceMetadata

 | getResourceMetadata(resid)

Gets metadata for a specified resource.

args: -- resid: hydroshare resource id

returns: -- resource metadata object

createResource

 | createResource(abstract, title, keywords=[], content_files=[])

Creates a hydroshare resource.

args: -- abstract: abstract for resource (str, required) -- title: title of resource (str, required) -- keywords: list of subject keywords (list, default=>[]) -- content_files: data to save as resource content (list, default=>[])

returns: -- resource_id

getResource

 | getResource(resourceid)

Downloads content of a hydroshare resource.

args: -- resourceid: id of the hydroshare resource (str)

returns: -- None

getResourceFiles

 | getResourceFiles(resid)

returns a list of files in a hydroshare resource

addContentToExistingResource

 | addContentToExistingResource(resid, source, target=None)

Adds content files to an existing hydroshare resource.

args: -- resid: id of an existing hydroshare resource (str) -- source: file path to be added to resource -- target: target path relative to the root directory of the resource

returns: -- None

loadResourceFromLocal

 | loadResourceFromLocal(resourceid)

Loads the contents of a previously downloaded resource.

args: -- resourceid: the id of the resource that has been downloaded (str)

returns: -- {content file name: path}