class download(url, *args, filename=None, save=True, parallel=True, die=True, verbose=True, **kwargs)[source]#

Download one or more URLs in parallel and return output or save them to disk.

A wrapper for sc.urlopen(), except with save=True by default.

  • url (str/list/dict) – either a single URL, a list of URLs, or a dict of URL:filename pairs

  • *args (list) – additional URLs to download

  • filename (str/list) – either a string or a list of the same length as url (if not supplied, return output)

  • save (bool) – if supplied instead of filename, then use the default filename

  • parallel (bool) – whether to download multiple URLs in parallel

  • die (bool) – whether to raise an exception if a URL can’t be retrieved (default true)

  • verbose (bool) – whether to print progress (if verbose=2, print extra detail on each downloaded URL)

  • **kwargs (dict) – passed to sc.urlopen()


html ='') # Download a single URL
data ='', '', save=False) # Download two in parallel{'':'sciris.html', '':'covasim.html'}) # Downlaod two and save to disk['', ''], filename=['sciris.html', 'covasim.html']) # Ditto
New in version 2.0.0.
New in version 3.0.0: “die” argument