The ‘Download a File’ feature allows the user to download a specific folder or file from a HydroShare resource. The instruction below consists of two steps. Step 1 will search through a given resource and then generate a list of files available. Step 2 will allow for the user to select and download a file from the resource.
Our demonstration code here is comprised of two steps. Step 1 will query the resource and generate a list of files available therein. Step 2 will actually download a selected file from a resource.
To try this on your own, you can use the code snippet below, or download the full javascript file that is used in this demonstration
from hs_restclient import HydroShare, HydroShareAuthBasic
auth = HydroShareAuthBasic(username='myusername', password='mypassword')
hs = HydroShare(auth=auth)
fname = 'somefile.txt'
fpath = hs.getResourceFile('ID OF RESOURCE GOES HERE', fname, destination='/directory/to/download/file/to')