| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…T client Cloudflare (520-527), AWS WAF (561), and other proxies return status codes outside Python's http.HTTPStatus enum. The upstream openapi-python-client template blindly calls HTTPStatus(response.status_code) in _build_response, which raises ValueError on those codes and crashes every endpoint call. Customer report: Cloudflare 520 from get_api_prompts_by_id. Fix: - Add safe_http_status() helper in types.py that falls back to int on ValueError - Widen Response.status_code type from HTTPStatus to HTTPStatus | int - Override openapi-python-client Jinja templates (openapi-templates/) so future regenerations preserve the fix; wire --custom-template-path in Makefile - Apply the patch to all 90 already-generated endpoint files in place - Regression test for 520, 561, 499 and IANA codes Tracked upstream: openapi-generators/openapi-python-client#1407
…T client Cloudflare (520-527), AWS WAF (561), and other proxies return status codes outside Python's http.HTTPStatus enum. The upstream openapi-python-client template blindly calls HTTPStatus(response.status_code) in _build_response, which raises ValueError on those codes and crashes every endpoint call. Customer report: Cloudflare 520 from get_api_prompts_by_id. Fix: - Add safe_http_status() helper in types.py that falls back to int on ValueError - Widen Response.status_code type from HTTPStatus to HTTPStatus | int - Override openapi-python-client Jinja templates (openapi-templates/) so future regenerations preserve the fix; wire --custom-template-path in Makefile - Apply the patch to all 90 already-generated endpoint files in place - Regression test for 520, 561, 499 and IANA codes Tracked upstream: openapi-generators/openapi-python-client#1407
…T client (#4403) * fix(python-sdk): tolerate non-IANA HTTP status codes in generated REST client Cloudflare (520-527), AWS WAF (561), and other proxies return status codes outside Python's http.HTTPStatus enum. The upstream openapi-python-client template blindly calls HTTPStatus(response.status_code) in _build_response, which raises ValueError on those codes and crashes every endpoint call. Customer report: Cloudflare 520 from get_api_prompts_by_id. Fix: - Add safe_http_status() helper in types.py that falls back to int on ValueError - Widen Response.status_code type from HTTPStatus to HTTPStatus | int - Override openapi-python-client Jinja templates (openapi-templates/) so future regenerations preserve the fix; wire --custom-template-path in Makefile - Apply the patch to all 90 already-generated endpoint files in place - Regression test for 520, 561, 499 and IANA codes Tracked upstream: openapi-generators/openapi-python-client#1407 * chore(python-sdk): remove unused MagicMock import (CodeQL)
| Back | FazBrowse Home | New Git URL |
Summary
Added support for responses with non-standard HTTP Status Codes. Off by default, enabled with allow_int_response_codes.
Problem
Currently if a response with a status code that does not exist in http.HTTPStatusCode a ValueError is raised. For example: ValueError: 490 is not a valid HTTPStatus.
Edge Case
If a non-standard status code is received from an endpoint that doesn't define any responses with non-standard status codes the old behavior will appear.