from_file¶
-
classmethod
EncryptHelper.from_file(obj: Union[str, _io.TextIOWrapper], **settings)[source]¶ Create an instance of
EncryptHelper(or inheriting class) using a Fernet key loaded from a file, or stream object.>>> enc = EncryptHelper.from_file('/home/john/fernet.key') >>> d = enc.encrypt('hello') >>> enc.decrypt(d) 'hello'
- Parameters
obj (TextIOWrapper) – Load the key from the filename
objobj – Load the key from the file/stream object
objusing.read()