PathLike upload tuples fail with an opaque connection error
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 93
- Fork
- 16
- Merge trung bình
- 11 phút
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của browserbase/sdk-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
browserbase/sdk-python#182 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
browserbase/sdk-python#180 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
browserbase/sdk-python#179 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
browserbase/sdk-python#178 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
browserbase/sdk-python#176 ·
Tất cả issue của browserbase/sdk-python
Issue tương tự
-
essnmx good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
-
[Feature] 奇物选择添加优先级 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
syfoud/Simulated_Scepter#174 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Giskard-AI/giskard-oss#2840 · 1 bình luận ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Đang mởarea: repo bug perceived difficulty: 2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
yeti-platform/yeti#1380 ·