DocumentObject

class docushare.DocumentObject(docushare, hdl, title, filename, document_control_number, version_handles)

Bases: FileObject

Represents one Document object in DocuShare.

Parameters
  • docushare (DocuShare) – The DocuShare site that this object belongs to.

  • hdl (Handle) – The DocuShare handle that represents this object. The type must be HandleType.Document.

  • title (str) – Title of this document.

  • filename (str) – File name of this document.

  • document_control_number (str or None) – Document conrol number of this document. This can be None if document control number is not defined.

  • version_handles (list) – Version handles of this document. list of Handle instances.’

Attributes Summary

document_control_number

Document control number.

docushare

The DocuShare site that this object belongs to.

download_url

URL to download this document.

filename

File name of this document.

handle

The DocuShare handle that represents this object.

title

Title of this document.

version_handles

Version handles of this document.

versions

Version objects of this document.

Methods Summary

download([path, size_for_progress_report])

Download this document from the DocuShare site to the local storage.

Attributes Documentation

document_control_number

Document control number.

Type

str

docushare

The DocuShare site that this object belongs to.

Type

DocuShare

download_url

URL to download this document.

Type

str

filename

File name of this document.

Type

str

handle

The DocuShare handle that represents this object.

Type

Handle

title

Title of this document.

Type

str

version_handles

Version handles of this document.

Type

list of Handle

versions

Version objects of this document.

Type

list of VersionObject

Methods Documentation

download(path=None, size_for_progress_report=1000000)

Download this document from the DocuShare site to the local storage.

Parameters
  • path (path-like object or None) – If it is None, this method downloads the document as a file in the current directory and the file name is determined as suggested by the DocuShare site. If it is a directory path, the document is downloaded as a file in the given directory and the file name is determined as suggested by the DocuShare site. If the given path is not a directory or does not exist, the document is downloaded as a file to the given path.

  • size_for_progress_report (int) – This method shows a progress bar using tqdm <https://tqdm.github.io/> if the file size is more than the specified size in bytes.

Returns

Path to the downloaded file.

Return type

path-like object