get_password method

get_password

Retrieves the password for the specified file.

def get_password(self, key):
    ...
Parameter Type Description
key str The full file path or a document key.

Returns: str: The password for the document.

Example

import os

from groupdocs.search import Index

index = Index("./index")
passwords = index.dictionaries.document_passwords

# The key is the full path of the document
document_path = os.path.abspath("./documents/protected.pdf")
passwords.add(document_path, "123456")
print(passwords.get_password(document_path))

Aliases

These names call get_password too, limited to the overloads listed.

Alias Accepts
get_password_file get_password_file(key)
get_password_string get_password_string(key)

See Also