Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

PathLike upload tuples fail with an opaque connection error

Đang mở
#196 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api

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

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của browserbase/sdk-python

Tất cả issue của browserbase/sdk-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.