PathLike upload tuples fail with an opaque connection error
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 93
- Fork
- 16
- Merge medio
- 11m
- PR unite (30g)
- 3
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di browserbase/sdk-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
browserbase/sdk-python#182 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
browserbase/sdk-python#180 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
browserbase/sdk-python#179 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
browserbase/sdk-python#178 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
browserbase/sdk-python#176 ·
Tutte le issue di browserbase/sdk-python
Issue simili
-
Add: hunch Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DiamondLightSource/dodal#2211 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
openml/openml-python#1749 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
sipyourdrink-ltd/bernstein#6191 ·