You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Crawl4aiDockerClient has no public option for the API token the 0.9 server requires #2474
The SDK client can talk to a 0.9 server, which requires CRAWL4AI_API_TOKEN on every request.
Current Behavior
Crawl4aiDockerClient has no token option, and every request returns:
401 Authentication required
client.authenticate(email) does not help: it posts only {"email": ...} to /token, but since 0.9.0 /token also requires api_token in the body, so it returns 401 (or 403 when no token is configured).
The only working way is to set a private attribute, as deploy/docker/README.md does today:
fromcrawl4ai.docker_clientimportCrawl4aiDockerClientasyncwithCrawl4aiDockerClient(base_url="http://localhost:11235") asclient:
awaitclient.crawl(["https://example.com"])
# RequestError: Server error 401: Authentication required
Proposed fix
Add api_token: Optional[str] = None to Crawl4aiDockerClient.__init__ and send it as Authorization: Bearer <token> on every request. With the private _token workaround the header is set only inside crawl(), so get_schema() still returns 401. I'll open a PR.
The broken authenticate() is left for a separate change.
Activity