extract_msg.attachments.custom_att_handler.custom_handler Module
Module contents
- class extract_msg.attachments.custom_att_handler.custom_handler.CustomAttachmentHandler(attachment: AttachmentBase)[source]
Bases:
ABC
A class designed to help with custom attachments that may require parsing in special ways that are completely different from one another.
- getStream(filename: str | List[str] | Tuple[str]) bytes | None [source]
Gets a stream from the custom data directory.
- getStreamAs(streamID: str | List[str] | Tuple[str], overrideClass: Type[_T] | Callable[[Any], _T]) _T | None [source]
Returns the specified stream, modifying it to the specified class if it is found.
- Parameters:
overrideClass – Class/function to use to morph the data that was read. The data will be the first argument to the class’s __init__ function or the function itself, if that is what is provided. If the value is None, this function is not called. If you want it to be called regardless, you should handle the data directly.
- abstract classmethod isCorrectHandler(attachment: AttachmentBase) bool [source]
Checks if this is the correct handler for the attachment.
- abstract generateRtf() bytes | None [source]
Generates the RTF to inject in place of the objattph tag.
If this function should do nothing, returns
None
.
- property attachment: AttachmentBase
The attachment this handler is associated with.
- abstract property data: bytes | None
Gets the data for the attachment.
If an attachment should do nothing when saving, returns
None
.
- abstract property name: str | None
Returns the name to be used when saving the attachment.
- abstract property obj: object | None
Returns an object representing the data.
May return the same value as :property data:.
If there is no object to represent the custom attachment, including
bytes
, returnsNone
.
- property objInfo: ODTStruct | None
The structure representing the stream “x03ObjInfo”, if it exists.
- property ole: OleStreamStruct | None
The structure representing the stream “x01Ole”, if it exists.
- property presentationObjs: Dict[int, OLEPresentationStream] | None
Returns a dict of all presentation streams, as bytes.