Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions deploy/docker/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,12 @@ def _attach_declarative_hooks(crawler, hooks_config: dict) -> dict:

def _raise_for_crawl_failure(result):
if not result.success:
err = result.error_message or "Crawl failed"
# 403 for anti-bot / blocked results (PR #2185), 500 for other failures.
code = status.HTTP_403_FORBIDDEN if "blocked" in err.lower() or "anti-bot" in err.lower() else status.HTTP_500_INTERNAL_SERVER_ERROR
raise HTTPException(
status_code=status.HTTP_502_BAD_GATEWAY,
detail=result.error_message,
status_code=code,
detail=err,
)


Expand Down