[Feature]: Crawl4aiDockerClient has no public option for the API token the 0.9 server requires

オープン 初心者向け
#2,474 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
77/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api, backend

調査の方向性

まず Crawl4aiDockerClient の定義を見つけ、get_schema() を含めてリクエストの送信方法を追跡してください。既存のクライアントテストがあるか確認してください。完了条件は、呼び出し側が初期化時に api_token を指定でき、すべてのリクエストで Bearer トークンが送信されることです。クロールとスキーマへのアクセスの両方をカバーするテストを追加してください。

索引モデルが issue の本文から書いたものです。

説明

⚙ Done ✨ Enhancement
crawl4ai version

0.9.5 (also on develop; since 0.9.0)

Expected Behavior

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:

client._token = os.environ["CRAWL4AI_API_TOKEN"]
# or
client._http_client.headers["Authorization"] = "Bearer <token>"
Is this reproducible?

Yes

Code snippets
from crawl4ai.docker_client import Crawl4aiDockerClient

async with Crawl4aiDockerClient(base_url="http://localhost:11235") as client:
    await client.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.

OS

macOS 26.6 (platform-independent)

Python version

3.13

主要言語
Python
スター
86.8k
フォーク
9k
平均マージ
2日 12時間
マージ済み PR(30日)
21

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

unclecode/crawl4ai のほかの issue

unclecode/crawl4ai の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。