API reference¶
- class pylacus.CaptureResponse¶
A capture made by Lacus. With the base64 encoded image and downloaded file decoded to bytes.
- class pylacus.CaptureResponseJson¶
A capture made by Lacus. With the base64 encoded image and downloaded file not decoded.
- class pylacus.CaptureSettings(**kwargs)¶
The capture settings that can be passed to Lacus.
- class pylacus.CaptureStatus(*values)¶
The status of the capture
- class pylacus.RemoteHeadedSessionResponse¶
Response from the remote headed session status and finish endpoints.
- class pylacus.SessionStatus(*values)¶
The status of an remote headed session
PyLacus¶
- class pylacus.PyLacus(root_url: str, useragent: str | None = None, *, proxies: dict[str, str] | None = None)¶
- daily_stats(d: str | date | datetime | None = None, /, *, cardinality_only: bool = True) dict[str, Any]¶
Get the stats for a specific day (only the last few days are stored in lacus).
- Parameters:
cardinality_only – If True, only return the number of entries in each list (captures, retries, failed retries), instead of the URLs.
- db_status() dict[str, Any]¶
Gets the database status (number of keys, memory usage)
- enqueue(*, settings: CaptureSettings | dict[str, Any] | None = None) str¶
- enqueue(*, url: str | None = None, document_name: str | None = None, document: str | None = None, depth: int = 0, browser: Literal['chromium', 'firefox', 'webkit'] | None = None, device_name: str | None = None, user_agent: str | None = None, proxy: str | dict[str, str] | None = None, general_timeout_in_sec: int | None = None, cookies: str | dict[str, str] | list[dict[str, Any]] | list[Cookie] | None = None, storage: str | dict[str, Any] | None = None, headers: str | dict[str, str] | None = None, http_credentials: dict[str, str] | HttpCredentialsSettings | None = None, geolocation: dict[str, str | int | float] | GeolocationSettings | None = None, timezone_id: str | None = None, locale: str | None = None, color_scheme: Literal['dark', 'light', 'no-preference', 'null'] | None = None, java_script_enabled: bool = True, viewport: dict[str, int | str] | ViewportSettings | None = None, referer: str | None = None, with_screenshot: bool = True, with_favicon: bool = False, with_trusted_timestamps: bool = False, allow_tracking: bool = False, headless: bool = True, remote_headfull: bool = False, init_script: str | None = None, rendered_hostname_only: bool = True, force: bool = False, recapture_interval: int = 300, final_wait: int = 5, priority: int = 0, max_retries: int | None = None, uuid: str | None = None) str
Submit a new capture. Pass a typed dictionary or any of the relevant settings, get the UUID.
- finish_remote_headed_session(uuid: str) RemoteHeadedSessionResponse¶
Request a final capture of the current page for a remote headed session.
- get_capture(uuid: str, *, decode: Literal[True] = True) CaptureResponse¶
- get_capture(uuid: str, *, decode: Literal[False]) CaptureResponseJson
Get the the capture, with the screenshot and downloaded file decoded to bytes or base64 encoded.
- get_capture_status(uuid: str) CaptureStatus¶
Get the status of the capture.
- get_remote_headed_session(uuid: str) RemoteHeadedSessionResponse¶
Get the status and public view details for a remote headfull capture session.
- is_busy() bool¶
Check if the instance is busy.
- property is_up: bool¶
Test if the given instance is accessible
- playwright_devices() dict[str, Any]¶
Get the proxies enabled on the instance.
- proxies() dict[str, Any]¶
Get the proxies enabled on the instance.
- push_capture(uuid: str, push_to: str) dict[str, Any]¶
Push the capture to a specific endpoint.
- Parameters:
uuid – UUID of the capture to push (in the lacus instance you are querying).
push_to – Endpoint to push the results of the capture to.
- redis_up() dict[str, Any]¶
Check if redis is up and running
- settings() dict[str, str | bool | int]¶
The public settings for the instance
- status() dict[str, Any]¶
Get the status of the instance.