Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

PathLike upload tuples fail with an opaque connection error

Abierto
#196 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
api

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
93
Forks
16
Merge medio
11 min
PR fusionados (30 d)
3

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de browserbase/sdk-python

Todos los issues de browserbase/sdk-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.