Skip to content

Normalize HTTP error handling across SGS, Currency, and OData #31

Description

@wilsonfreitas

Context

HTTP behavior is inconsistent across modules. bcb/http.py defines shared clients and retry helpers, but feature modules import _CLIENT and _ASYNC_CLIENT directly and each module handles response failures differently.

Scope

Introduce one shared HTTP response handling approach for sync and async requests. Normalize status handling for 429, 404, 5xx, timeout, and connection failures.

Branching

Create the implementation branch from project-health-hardening and merge the fix back into project-health-hardening before any merge to main.

Acceptance Criteria

  • SGS, Currency, and OData use a consistent error mapping strategy.
  • Existing public exceptions remain backward compatible where possible.
  • Tests cover 429, 404, 5xx, timeout, and malformed response cases.
  • uv run pytest -m "not integration", Ruff, and mypy pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: currencyCurrency/PTAX scraping and exchange-rate APIarea: httpShared HTTP client, retries, errors, and lifecyclearea: odataOData service discovery, metadata, query building, and endpointsarea: sgsSGS time series APIpriority: highHigh urgency or high impacttype: refactorInternal refactoring without intended feature changes

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions