Package: autopytic
autopyticImprove your RPA python code with wrapper 🤯Feautes- Easy to use on existing scripts
- Auto-emails notifications at exception
- Auto-handling statuses on base worflow
- Auto-generate code timmings and save into file
- Auto-generate logs writer base on used functions workflow
- Auto-documentation code after every robot end
- Auto-progress with recalculation on-the-fly
- Auto-update robot status on management system using your own REST-API
- Auto-uploading logs into server using your own REST-API
- Auto-fetch config json from server using your own REST-API
- Simple VSC snippets to be fastest RPA Developers in the entire word...
...InstallationUse the package managerpipto install foobar.pipinstallautopytic
pipinstallpython-dotenv
pipinstallrequestsIn  your main python script localization create file named .pytic with:# Settings# Turn on-off debug modeDEBUG_MODE=false# Turn on-off error raise after exceptionERROR_RAISE=false# Email Settings# Turn on-off send email after exception with log fileSEND_EXCEPTIONS=false# SMTP HOST ADRESSSMTP_HOST=# SMTP PORTSMTP_PORT=# SMTP SENDER EMAILSENDER_EMAIL=# SMTP SENDER EMAIL PASSWORDSENDER_PASS=# List of email addresses to which messages are sent :: separated by commaRECIVER_EMAIL=# Coverage Settings# Exclude given paths from code coverage (example ./venv):: separated by commaEXCLUDE_VENV=# Status Settings# Default script execute first time in ms (does not need to be edited)DEFAULT_EXECUTE_TIME=1000000000# Address to which the response with the robot's status and progress is to be sentRESPONSE_URL=# Response refresh rate in ms# If the robot is fast, it is recommended to lower the rate to indicate status other than 0-100STATUS_REFRESH_RATE=0.1# Active status name for responseSTATUS_ACTIVE=Aktywny# Completed status name for responseSTATUS_COMPLETED=Zakonczony# Error status name for responseSTATUS_ERROR=Krytyczny# Disalbled status name for responseSTATUS_DISABLED=Wyłączony# Returning together with the status of the place where the robot is locatedSTATUS_WITH_STATE=false# This form is helpful for previewing progress in the console :: Turn on-offSTATUS_PRINTER=false# Logs Settings# Address to upload logs into serverUPLOAD_LOGS_URL=# Config Settings# Addres to fetch json config from serverGET_CONFIG_URL=Usage examplefromautopytic.tools.wrapperimportWrapperfromrandomimportrandintimporttimeRobot=Wrapper(robot_path='',log_file='logs.txt')class_Robot:@Robot.register_event(description='Initialized robot')def__init__(self):pass@Robot.register_event(description='Run robot method',start=True)defrun(self):Robot.info(Robot.config['type'])time.sleep(3)self.check_file()time.sleep(3)@Robot.register_event(description='Checking file')defcheck_file(self):pass@Robot.register_event(description='End method',end=True)defend(self):passr=_Robot()try:r.run()r.end()exceptKeyboardInterrupt:# Disabled by Manualr.end()exceptExceptionase:# Disabled by Exceptionr.end()raiseException(e)Console outputDebug mode console outputTipsError handlingERROR_RAISE=false# Wrapper will not return any exception after a failed action easy to debug step actionsERROR_RAISE=true# Wrapper will return exception after a failed actionLoop handlingIf you want to read the code based on loops easier, use in_loop (default false), to avoid too much spam in the documentation, the display loops are slightly shortened:@Robot.register_event(description="Say hello",in_loop=True)defsay_hello():return'hello'Email reportsAuto-loggingFAIL | 2021-03-18 20:01:19.479666 | say_hello | (<__main__.Robot object at 0x105d20460>,) | Say hello |  - ms | unsupported operand type(s) for +: 'int' and 'str' 
 PASS | 2021-03-18 20:01:19.789123 | process_and_response | (<__main__.Robot object at 0x105d20460>, <Response [200]>) | Try to scrap something and return value | 0.0019073486328125ms |  -  
 PASS | 2021-03-18 20:01:19.789445 | get_page | (<__main__.Robot object at 0x105d20460>, 'https://www.google.pl/') | Send requests to get scrapping page | 307.56616592407227ms |  -Auto-documentationThe code is automatically documented after each work completion and put into the docs.txt fileOutputStep 0 -> use function run to do Final Run robot method
Step 1 -> use function fetch_from_site to do Fetch something from site
Step 2 -> use function say_hello to do Say hello
Step 3 -> use function get_page to do Send requests to get scrapping page
Step 4 -> use function end to do Final End robot methodCode coverageTo check code coverage use in main directorypython3-mautopyticcoverageVisualStudio Code SnippetIn order not to focus on writing it every time, it is worth adding a snippet to your IDE as in this case:"init_robot":{"prefix":"init","body":["from autopytic.tools.wrapper import Wrapper","","Robot = Wrapper(robot_path='${1:robot_path}',log_file='logs.txt')","","","class Robot:","    @Robot.register_event(description='Initialized robot')","    def __init__(self):","        pass","","    @Robot.register_event(description='Run robot method', start=True)","    def run(self):","        pass","","    @Robot.register_event(description='End method', end=True)","    def end(self):","        pass","","","r = Robot()","","try:","    r.run()","    r.end()","except (KeyboardInterrupt, Exception) as e:","    r.end()"],"description":"Initialize new robot"},"register_event":{"prefix":"register","body":["@Robot.register_event(${1:description})"],"description":"Register new robot event"},"function_with_register":{"prefix":"_def","body":["@Robot.register_event(description='${1:description}')","def ${2:method_name}(self):","   pass",""],"description":"New method with registered event"}