PathLike upload tuples fail with an opaque connection error
まだ誰も着手していません。
評価
調査の方向性
Start with is_file_content() and _transform_file(), which handle the shared upload path for certificate, extension, and session uploads. Run the existing upload tests and add sync and async coverage for PathLike values in the supported tuple shapes. Done means tuple uploads read the path while preserving the custom filename, content type, and optional headers.
索引モデルが issue の本文から書いたものです。
説明
What happened?
A bare Path works as an upload, but the tuple form accepted by FileTypes does not:
from pathlib import Path
client.sessions.uploads.create(
"session-id",
file=("custom.md", Path("README.md"), "text/markdown"),
)
On current main at 5f5274b, this raises:
APIConnectionError: Connection error.
The underlying cause is:
AttributeError: 'PosixPath' object has no attribute 'read'
The same path is shared by certificate, extension, and session uploads.
Why it happens
is_file_content() treats every tuple as terminal file content. That means _transform_file() returns the tuple unchanged before its tuple-handling branch can read the PathLike value inside it. HTTPX later receives the raw Path and tries to call .read() on it.
Expected behavior
A PathLike inside any supported upload tuple should be read just like a bare Path, while preserving the custom filename, content type, and optional headers.
I have a small fix ready that keeps tuples separate from direct file content and adds sync and async coverage for all three supported tuple shapes.
- 主要言語
- Python
- スター
- 93
- フォーク
- 16
- 平均マージ
- 11分
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
browserbase/sdk-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
browserbase/sdk-python#182 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
browserbase/sdk-python#180 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
browserbase/sdk-python#179 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
browserbase/sdk-python#178 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
browserbase/sdk-python#176 ·
browserbase/sdk-python の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
canonical/paas-charm#368 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
tech debt
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
StevenBlack/hosts#3256 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
qualcomm/qai-appbuilder#275 ·