Thoughtful is a python package by Thoughtful for helping manage automations with helpful packages like supervisor
Project description
thoughtful is a collection of open-source libraries and tools for Robot Process Automation (RPA) development. The goal of this project is to provide a set of for supervising bot execution, and enabling these bots to do more.
This project is:
- Open-source: GitHub
- Owned by thoughtful
- Licensed under the Apache License 2.0
Links:
thoughtful is available on PyPI and can be installed using pip:
pip install thoughtful
thoughtful officially supports Python 3.7+.
Libraries
Supervisor
Supervisor is a Workflow Engine for Digital Workers that constructs and broadcasts a detailed and structured telemetric log, called the Run Report.
Detailed documentation
Detailed documentation on how to utilize Supervisor can be found here.
Usage
from thoughtful.supervisor import step, step_scope, supervise, set_step_status
# using the step decorator
@step("2")
def step_2(name: str) -> bool:
print(f'Hello {name}')
return True # some condition
def main() -> None:
# using the step_scope context manager
with step_scope('1') as step_context:
try:
print("Getting credentials")
# ...
except Exception as e:
# set step status using method
step_context.set_status("warning")
if not step_2():
# set step status using function
set_step_status("2", "fail")
if __name__ == '__main__':
with supervise():
main()
Screen Recorder
The ScreenRecorder library facilitates the recording of screen activity from a programmatic browser session and generates a video file of the recorded session.
Detailed documentation
Detailed documentation on how to utilize Screen Recorder can be found here.
Prerequisites
Ensure you have already downloaded FFmpeg
as it is utilized to create the video recording.
https://www.ffmpeg.org/download.html
Installation
Install the optional screen-recorder
extras
Poetry
poetry install -E screen-recorder
Pip
pip install thoughtful[screen-recorder]
Usage
WARNING: It is essential that you call end_recording
at the end of a recording.
If you do not call end_recording
, the recording threads will continue to run until your program ends and a
video will not be created.
from thoughtful.screen_recorder import ScreenRecorder, BrowserManager
from RPA.Browser.Selenium import Selenium # This dependency must be installed separately
class YoutubeScraper(ScreenRecorder):
def __init__(self) -> None:
self._selenium_instance = Selenium()
super().__init__(browser_manager=BrowserManager(instance=self._selenium_instance))
youtube_scraper = YoutubeScraper()
try:
# ... Perform actions here ...
finally:
if youtube_scraper:
# We recommend calling `end_recording` in a `finally` block to ensure that
# video processing occurs and all recording threads are terminated even if the Process fails
youtube_scraper.end_recording()
Contributing
Contributions to thoughtful are welcome!
To get started, see the contributing guide.
Made with ❤️ by
This project is open-source and licensed under the terms of the Apache License 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file thoughtful-2.9.2.tar.gz
.
File metadata
- Download URL: thoughtful-2.9.2.tar.gz
- Upload date:
- Size: 37.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.20 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f10ffbe34a15b664915ca6346c47a7d1772bf263f72a1484a6be6fc1d70c784 |
|
MD5 | e0d773af06d69adeed59ffdbf68e5c1b |
|
BLAKE2b-256 | 9f663787b9c589bda7eedfd7e44a11298fb6020f6d620a8513d19e36765fd799 |
File details
Details for the file thoughtful-2.9.2-py3-none-any.whl
.
File metadata
- Download URL: thoughtful-2.9.2-py3-none-any.whl
- Upload date:
- Size: 47.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.20 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edaf649f92c04d254cb6c12198f44153c9f286c50027676253b647ca142477c0 |
|
MD5 | eee725debc3b93978689a23e4336b7d5 |
|
BLAKE2b-256 | eb63918c6763ebc40e51779002cc8679334ff024175e27ca2a8913ba6bdb1a66 |