TLS failures are masked by AttributeError when API exception body is None

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

Nadie ha tomado este issue todavía.

Evaluación

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

Línea de trabajo

Start with gen/templates/api_client.mustache and the generated api_client.py exception-body decoding described in the issue. Review the linked signed fix and its tests to understand the reported behavior; verify that None and string bodies are handled while byte bodies retain UTF-8 decoding. The issue reports five public AssetsApi regression and control tests passing, with broader suite limitations noted.

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

Descripción

Problem

A TLS transport error through AssetsApi.list_assets() is replaced by AttributeError: 'NoneType' object has no attribute 'decode', obscuring the intended SDK ApiException and its diagnostic reason. The REST layer constructs ApiException(status=0, reason=...) without a response body; the API client unconditionally decodes e.body.

Offline reproduction
from unittest.mock import patch
import urllib3
from mux_python import ApiClient, AssetsApi

with ApiClient() as client:
    with patch.object(client.rest_client.pool_manager, 'request',
                      side_effect=urllib3.exceptions.SSLError('certificate failed')):
        AssetsApi(client).list_assets()

Expected: ApiException with status 0 and the SSL diagnostic. Actual: AttributeError at api_client.py's exception-body decoding. Already-decoded string bodies also fail there; byte bodies should retain UTF-8 decoding.

Following the README's issue-only workflow, I published a tested fork rather than opening a PR: signed fix and tests. It updates both gen/templates/api_client.mustache and the generated client to decode only byte bodies.

Validation and limits

Five tests exercise public AssetsApi calls: three regressions fail and two byte-body controls pass before; all five pass after. Broader suite, excluding an existing missing-model import: 274 pass / 5 fail after versus 269 pass / the same five fail on unchanged production code without the new tests. The missing list_real_time_dimensions_response_data model is absent from HEAD. Python 3.12 and pytest 8; the pinned pytest 4 is incompatible with that runtime. Changed files compile; diff check passes. No live Mux requests or full Python matrix run.

Prepared with AI assistance; maintainer review pending.

Lenguaje dominante
Python
Estrellas
68
Forks
17
Merge medio
10 h 50 min
PR fusionados (30 d)
3

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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 muxinc/mux-python

Todos los issues de muxinc/mux-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.