HIEvPy is a python wrapper around the API interface of the HIEv, a data capture application used by the Hawkesbury Institute for the Environment at Western Sydney University.
The search_download function extends the HievPy search function by downloading found records to your local computer. It is structured in a similar manner to the search function with the addition of an optional local path where records will be downloaded to.
import hievpy as hp
hp.search_download(api_token, base_url, search_params, path=None)
where
As with the search function, it is highly recommended that you supply at least one search query to your search to limit returning the full database in one call
You can download a Jupyter notebook version of this example from the /examples folder on the github project page.
As an example, to search for all records associated with experiment 82 dating back to 2nd January 2018 and download them to a subfolder called Downloads within the current location
import hievpy as hp
from pathlib import Path
import credentials as c
api_token = c.hiev_api_key
base_url = 'https://hiev.westernsydney.edu.au/'
search_params = {"experiments": ['82'],
"from_date": "2018-01-02"}
downloads = Path.cwd() / 'Downloads'
downloads.mkdir(exist_ok=True)
hp.search_download(api_token, base_url, search_params, path=downloads)