From 6bf3cee4ec1a4ae28d26f23fcc7ea4484ff1eee5 Mon Sep 17 00:00:00 2001 From: mtauha Date: Sat, 26 Sep 2026 17:08:09 +0500 Subject: [PATCH] fix: bump psxdata to 1.1.1 to send PSX X-Req-Id token PSX started requiring an X-Req-Id request token on its data endpoints on 2026-09-24, so every psxdata call raises PSXAuthError on a 403 and every data endpoint here has been returning 502 upstream_data_error since then. psxdata 1.1.1 fetches and sends the token automatically (mtauha/psxdata#161, fixed in mtauha/psxdata#163). No API changes on our side: BaseScraper only gained an optional token_provider kwarg, PSXClient/module functions/exceptions are unchanged. Bumped the pin in both pyproject.toml and api/requirements.txt to keep them in sync, per established convention, and bumped this package to 0.2.1 for the fix. Verified against the published 1.1.1 wheel: ruff/mypy/pytest all pass, and a local uvicorn smoke test against live PSX returns 200s from /health, /stocks/HBL/quote, /sectors and /indices instead of the 403- driven errors. --- CHANGELOG.md | 9 +++++++++ api/requirements.txt | 2 +- pyproject.toml | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fd1ab9..9933b85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm --- +## [0.2.1] — 2026-09-26 + +### Fixed + +- Every data endpoint (`/stocks`, `/indices`, `/sectors`, `/sectors/{name}/stocks`, `/screener`) was returning `502 upstream_data_error` since 2026-09-24, because PSX started requiring an `X-Req-Id` request token on its data endpoints and the pinned `psxdata` version had no way to send one. Bumped the `psxdata` pin to `1.1.1`, which fetches and sends the token automatically ([mtauha/psxdata#161](https://github.com/mtauha/psxdata/issues/161)). No API changes on our side. + +--- + ## [0.2.0] — 2026-09-02 ### Added @@ -74,6 +82,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm --- +[0.2.1]: https://github.com/mtauha/psxdata-api/releases/tag/v0.2.1 [0.2.0]: https://github.com/mtauha/psxdata-api/releases/tag/v0.2.0 [0.1.3]: https://github.com/mtauha/psxdata-api/releases/tag/v0.1.3 [0.1.2]: https://github.com/mtauha/psxdata-api/releases/tag/v0.1.2 diff --git a/api/requirements.txt b/api/requirements.txt index 072d2b5..86900f7 100644 --- a/api/requirements.txt +++ b/api/requirements.txt @@ -1,5 +1,5 @@ # API layer dependencies — installs psxdata from PyPI + FastAPI stack -psxdata==1.1.0 +psxdata==1.1.1 fastapi~=0.100 uvicorn[standard]~=0.23 slowapi~=0.1 diff --git a/pyproject.toml b/pyproject.toml index 9320c22..e1a2c09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta" [project] name = "psxdata-api" -version = "0.2.0" +version = "0.2.1" description = "FastAPI REST service for Pakistan Stock Exchange (PSX) data" readme = "README.md" requires-python = ">=3.11" license = {file = "LICENSE.md"} dependencies = [ - "psxdata==1.1.0", + "psxdata==1.1.1", "fastapi[standard]>=0.100", "uvicorn[standard]>=0.23", "slowapi>=0.1",