diff --git a/playwright_recaptcha/recaptchav2/async_solver.py b/playwright_recaptcha/recaptchav2/async_solver.py index e5ad249..09e6fc1 100644 --- a/playwright_recaptcha/recaptchav2/async_solver.py +++ b/playwright_recaptcha/recaptchav2/async_solver.py @@ -54,7 +54,7 @@ def __init__( self._token: Optional[str] = None self._payload_response: Union[APIResponse, Response, None] = None - self._page.on("response", self._response_listener) + self._page.on("response", self._response_callback) def __repr__(self) -> str: return ( @@ -112,9 +112,9 @@ async def _get_task_object(recaptcha_box: AsyncRecaptchaBox) -> Optional[str]: return None - async def _response_listener(self, response: Response) -> None: + async def _response_callback(self, response: Response) -> None: """ - Listen for payload and userverify responses. + The callback for intercepting payload and userverify responses. Parameters ---------- @@ -520,7 +520,7 @@ async def _get_recaptcha_box(self) -> AsyncRecaptchaBox: def close(self) -> None: """Remove the response listener.""" try: - self._page.remove_listener("response", self._response_listener) + self._page.remove_listener("response", self._response_callback) except KeyError: pass diff --git a/playwright_recaptcha/recaptchav2/sync_solver.py b/playwright_recaptcha/recaptchav2/sync_solver.py index d96c4ae..40956be 100644 --- a/playwright_recaptcha/recaptchav2/sync_solver.py +++ b/playwright_recaptcha/recaptchav2/sync_solver.py @@ -46,7 +46,7 @@ def __init__( self._token: Optional[str] = None self._payload_response: Union[APIResponse, Response, None] = None - self._page.on("response", self._response_listener) + self._page.on("response", self._response_callback) def __repr__(self) -> str: return ( @@ -104,9 +104,9 @@ def _get_task_object(recaptcha_box: SyncRecaptchaBox) -> Optional[str]: return None - def _response_listener(self, response: Response) -> None: + def _response_callback(self, response: Response) -> None: """ - Listen for payload and userverify responses. + The callback for intercepting payload and userverify responses. Parameters ---------- @@ -493,7 +493,7 @@ def _get_recaptcha_box(self) -> SyncRecaptchaBox: def close(self) -> None: """Remove the response listener.""" try: - self._page.remove_listener("response", self._response_listener) + self._page.remove_listener("response", self._response_callback) except KeyError: pass