fix: auto-restart when captcha was encountered

This commit is contained in:
sebthom
2025-05-12 17:20:51 +02:00
parent 65738926ae
commit ee4146f57c
2 changed files with 3 additions and 0 deletions

View File

@@ -1196,6 +1196,8 @@ def main(args:list[str]) -> None:
bot = KleinanzeigenBot() bot = KleinanzeigenBot()
atexit.register(bot.close_browser_session) atexit.register(bot.close_browser_session)
nodriver.loop().run_until_complete(bot.run(args)) nodriver.loop().run_until_complete(bot.run(args))
except CaptchaEncountered as ex:
raise ex
except Exception: except Exception:
error_handlers.on_exception(*sys.exc_info()) error_handlers.on_exception(*sys.exc_info())

View File

@@ -23,6 +23,7 @@ def on_exception(ex_type:type[BaseException] | None, ex_value:BaseException | No
LOG.error(ex_value) LOG.error(ex_value)
else: else:
LOG.error("%s: %s", ex_type.__name__, ex_value) LOG.error("%s: %s", ex_type.__name__, ex_value)
sys.exit(1)
def on_sigint(_sig:int, _frame:FrameType | None) -> None: def on_sigint(_sig:int, _frame:FrameType | None) -> None: