Acquire.Client._drive module

class Drive(user=None, name=None, storage_service=None, storage_url=None, autocreate=True)[source]

Bases: object

This class provides a handle to a user’s drive (space to hold files and folders). A drive is associated with a single storage service and can be shared amongst several users. Each drive has a unique UID, with users assiging their own shorthand names.

acl()[source]

Return the access control list for the user on this drive. If the ACL is not known, then None is returned

aclrules()[source]

Return the ACL rules used to grant access to this drive. This is only visible to owners of this drive. If it is not visible, then None is returned

download(filename, downloaded_name=None, version=None, dir=None)[source]

Download the file called ‘filename’ from this drive into the local directory, or ‘dir’ if specified, ideally called ‘filename’ (or ‘downloaded_name’ if that is specified). If a local file exists with this name, then a new, unique filename will be used. This returns a dictionary mapping the downloaded filename to the FileMeta of the file

Note that this only downloads files for which you have read-access. If the file is not readable then an exception is raised and nothing is returned

If ‘version’ is specified then download a specific version of the file. Otherwise download the latest version

guid()[source]

Return the global UID of this drive (combination of the UID of the storage service and UID of the drive)

is_null()[source]

Return whether or not this drive is null

list_drives()[source]

Return a list of the DriveMetas of all of the drives contained in this drive that are accessible to the user

list_files(include_metadata=False)[source]

Return a list of the FileMetas of all of the files contained in this drive

static list_toplevel_drives(user, storage_service=None, storage_url=None)[source]

Return a list of all of the DriveMetas of the drives accessible at the top-level by the passed user on the passed storage service

list_versions(filename, include_metadata=False)[source]

Return a list of all of the versions of the specified file. This returns an empty list if there are no versions of this file

name()[source]

Return the name given to this drive by the user

storage_service()[source]

Return the storage service for this drive

uid()[source]

Return the UID of this drive

upload(filename, uploaded_name=None, aclrules=None)[source]

Upload the file at ‘filename’ to this drive, assuming we have write access to this drive. The local file ‘filename’ will be uploaded to the drive as the file called ‘filename’ (just the filename - not the full path). If you want to specify the uploaded name then set this as “uploaded_name” (which again will just be a filename - no paths). If a file with this name exists, then this will upload a new version (assuming you have permission). Otherwise this will create a new file. You can set the ACL rules used to grant access to this file via ‘aclrule’. If this is not set, then the rules will be derived from either the last version of the file, or inherited from the drive.