Download a Resource

The way you could go about performing this function is by following the instructions below:

Step 1: Sign into HydroShare using your credentials

In the boxes below you enter your HydroShare username and its password. If you have to make an HydroShare account, click here.

This feature is to download the contents of a resource. The resource is zipped and downloaded, using a api from the HydroShare python library. The files can be extracted once they are downloaded.

Step 2: Type in your subject of the resource you are looking for

Step 3: Browse for the resource you are looking for

The resources related to the above mentioned subject will appear in the scroll below. Depending on the number of the resources with respect to the subject in HydroShare, it could take seconds to a few minutes:

The resource id is what you could use in other features of the app like adding a file or downloading a file or even deleting a file from a resource.

Resource id of the selected Resource:

Learn more:

To try this on your own, you can use the code snippet below that is used in this demonstration.

    
        auth = HydroShareAuthBasic(username= username, password= password)
        hs = HydroShare(auth=auth)
        fpath='/tmp/%s.zip' % title
        hs.getResource(title, destination='/tmp')

        wrapper = FileWrapper(open(os.path.abspath(fpath), 'rb')) 
        response = HttpResponse(wrapper, content_type='text/plain') 
        response['Content-Disposition'] = 'attachment; filename=%s' % os.path.basename(fpath) 
        response['Content-Length'] = os.path.getsize(fpath)
        return response