Helpers
psengine.classic_alerts.helpers
¶
save_image
¶
save_image(
image_bytes: bytes,
file_name: str,
output_directory: Union[
str, Path
] = DEFAULT_CA_OUTPUT_DIR,
) -> Path
Save an image to disk as a PNG file.
PARAMETER | DESCRIPTION |
---|---|
image_bytes
|
The image to save.
TYPE:
|
file_name
|
The file name to save the image as, without extension.
TYPE:
|
output_directory
|
The directory to save the image to.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValidationError
|
If any supplied parameter is of incorrect type. |
WriteFileError
|
In any of the following situations:
|
RETURNS | DESCRIPTION |
---|---|
Path
|
The path to the file written. |
Source code in psengine/classic_alerts/helpers.py
save_images
¶
save_images(
alert: ClassicAlert,
output_directory: Union[
str, Path
] = DEFAULT_CA_OUTPUT_DIR,
) -> dict
Save all images from a ClassicAlert
to disk.
PARAMETER | DESCRIPTION |
---|---|
alert
|
The alert to save images from.
TYPE:
|
output_directory
|
The directory to save the images to.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValidationError
|
If any supplied parameter is of incorrect type. |
WriteFileError
|
In any of the following situations:
|
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary of image file paths with the image ID as the key. |