motleycrew.tools.html_render_tool
Functions
|
Classes
|
Tool for rendering HTML as image. |
|
Input for the HTMLRenderTool. |
|
Helper for rendering HTML code as an image. |
- class motleycrew.tools.html_render_tool.HTMLRenderer(work_dir: str, chromedriver_path: str | None = None, headless: bool = True, window_size: Tuple[int, int] | None = None)
Bases:
object
Helper for rendering HTML code as an image.
- __init__(work_dir: str, chromedriver_path: str | None = None, headless: bool = True, window_size: Tuple[int, int] | None = None)
- render_image(html: str, file_name: str | None = None)
Create a PNG image from HTML code.
- Parameters:
html (str) – HTML code for rendering image.
file_name (str) – File name without extension.
- Returns:
Path to the rendered image.
- build_file_paths(file_name: str | None = None) Tuple[str, str]
Builds paths to html and image files
- class motleycrew.tools.html_render_tool.HTMLRenderTool(work_dir: str, chromedriver_path: str | None = None, headless: bool = True, window_size: Tuple[int, int] | None = None, return_direct: bool = False, exceptions_to_reflect: List[Exception] | None = None)
Bases:
MotleyTool
Tool for rendering HTML as image.
- __init__(work_dir: str, chromedriver_path: str | None = None, headless: bool = True, window_size: Tuple[int, int] | None = None, return_direct: bool = False, exceptions_to_reflect: List[Exception] | None = None)
- Parameters:
work_dir – Directory for saving images and HTML files.
chromedriver_path – Path to the ChromeDriver executable.
- class motleycrew.tools.html_render_tool.HTMLRenderToolInput(*, html: str)
Bases:
BaseModel
Input for the HTMLRenderTool.
- html: str
- motleycrew.tools.html_render_tool.create_render_tool(renderer: HTMLRenderer)