Skip to content

Commit

Permalink
Changed response callback name and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Xewdy444 committed Jul 30, 2023
1 parent c081327 commit b2248a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions playwright_recaptcha/recaptchav2/async_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
----------
Expand Down Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions playwright_recaptcha/recaptchav2/sync_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
----------
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit b2248a4

Please sign in to comment.