.. how to edit script to run automatically another file (simple bat that change mac and restart internet connection) when I get error 403(captcha) and then how to continue running script without starting it from the beginning (when connection drops the scrips shuts down). This way I can scrap again and with very small interval, but for now my method is just to restart the script with this bat file ( I get notifications for the items I already received notifications for unfortunately):
I found this piece of code in another watcher, but I dont know how to edit it to run bat file instead of going to sleep and dont know how to implement it to your bot to do expected job for me:
def run(self) -> NoReturn:
"""
Main Loop of the Scanner
"""
log.info("Scanner started ...")
while True:
if self.cron.is_now:
try:
self._job()
if self.tgtg_client.captcha_error_count > 10:
log.warning("Too many 403 Errors. Sleeping for 1 hour.")
sleep(60 * 60)
log.info("Continuing scanning.")
self.tgtg_client.captcha_error_count = 0
except Exception:
log.error("Job Error! - %s", sys.exc_info())
sleep(self.config.sleep_time * (0.9 + 0.2 * random()))
.. how to edit script to run automatically another file (simple bat that change mac and restart internet connection) when I get error 403(captcha) and then how to continue running script without starting it from the beginning (when connection drops the scrips shuts down). This way I can scrap again and with very small interval, but for now my method is just to restart the script with this bat file ( I get notifications for the items I already received notifications for unfortunately):
bat file content:
watch_script.bat content:
powershell py watch_script.py
I found this piece of code in another watcher, but I dont know how to edit it to run bat file instead of going to sleep and dont know how to implement it to your bot to do expected job for me: