Handle Uploads, Downloads, Repository access and manage temporary directories
download_to_directory(directory, url, basename=None, if_exists='skip', subdir=None)¶
Download a file to a directory.
Early Shortcut: If url is a local file and that file is already in the directory, keep it there.
If basename is not given but subdir is, assume user knows what she’s doing and use last URL segment as the basename. If basename is not given and no subdir is given, use the alnum characters in the URL as the basename.
directory (string) – Directory to download files to
basename (string, None) – basename part of the filename on disk.
url (string) – URL to download from
if_exists (string, "skip") – What to do if target file already exists. One of
subdir (string, None) – Subdirectory to create within the directory. Think fileGrp.
Local filename, __relative__ to directory
workspace_from_nothing(directory, mets_basename='mets.xml', clobber_mets=False)¶
Create an empty workspace.
workspace_from_url(mets_url, dst_dir=None, clobber_mets=False, mets_basename=None, download=False, src_baseurl=None)¶
Create a workspace from a METS by URL (i.e. clone it).
Sets the mets.xml file
mets_url (string) – Source mets URL
dst_dir (string, None) – Target directory for the workspace
clobber_mets (boolean, False) – Whether to overwrite existing mets.xml. By default existing mets.xml will raise an exception.
download (boolean, False) – Whether to download all the files
src_baseurl (string, None) – Base URL for resolving relative file locations