Skip to content

Commit

Permalink
fix: confirm check callback is set before inspecting args
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Jan 16, 2024
1 parent 0109e27 commit 35869ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions horde_sdk/ai_horde_api/ai_horde_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ def _do_request_with_check(
tuple[HordeResponse, JobID]: The final response and the corresponding job ID.
"""

if len(inspect.getfullargspec(check_callback).args) == 0:
if check_callback is not None and len(inspect.getfullargspec(check_callback).args) == 0:
raise ValueError("Callback must take at least one argument")

# This session class will cleanup incomplete requests in the event of an exception
Expand Down Expand Up @@ -914,7 +914,7 @@ async def _do_request_with_check(
AIHordeRequestError: If the request failed. The error response is included in the exception.
"""

if len(inspect.getfullargspec(check_callback).args) == 0:
if check_callback is not None and len(inspect.getfullargspec(check_callback).args) == 0:
raise ValueError("Callback must take at least one argument")

context: contextlib.AbstractContextManager | AIHordeAPIAsyncClientSession
Expand Down

0 comments on commit 35869ce

Please sign in to comment.