Skip to content

fix(stock): harden Pexels request compatibility - #595

Merged
1 commit merged into
OpenMontageInc:mainfrom
hydraxman:fix/pexels-request-headers
Nov 8, 2026
Merged

1 commit merged into
OpenMontageInc:mainfrom
hydraxman:fix/pexels-request-headers

Conversation

@hydraxman

Copy link
Copy Markdown
Contributor

Summary

  • send a centralized browser-compatible User-Agent on Pexels API and CDN requests
  • use Pexels’ current /v1/videos/search endpoint
  • keep the API key scoped to API requests rather than forwarding it to the CDN

Problem

Pexels requests currently rely on Python client signatures that some Cloudflare edges reject, while preflight still reports the provider as configured. The video search also uses Pexels’ deprecated endpoint. This can leave stock searches with no usable media despite valid configuration.

Testing

  • python -m pytest tests/tools/test_stock_source_adapters.py -q — 37 passed, 3 xfailed
  • python -m pytest tests/tools -q — 540 passed, 3 xfailed, 1 subtest passed
  • make test — 1831 passed, 11 skipped, 3 xfailed, 1 subtest passed
  • make lint — passed

Fixes #587

@hydraxman
hydraxman requested a review from calesthio as a code owner August 31, 2026 22:58

@calesthio calesthio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating Pexels request compatibility. Reviewed the full diff against main 63d1087a; official Pexels documentation now explicitly lists /v1/videos/ and deprecates the old /videos/ path (https://www.pexels.com/api/documentation/). The API key stays on API calls and is absent from CDN downloads. Validation: adapter suite 37 passed, 3 unrelated expected failures, including header/key-scope checks. No live Pexels call or credential was used.

@calesthio calesthio closed this Nov 7, 2026
@calesthio calesthio reopened this Nov 7, 2026
calesthio pushed a commit to manish511-github/OpenMontage that referenced this pull request Nov 8, 2026
# Conflicts:
#	tests/tools/test_stock_source_adapters.py
calesthio pushed a commit to manish511-github/OpenMontage that referenced this pull request Nov 8, 2026
…c#815

Adapted from PR OpenMontageInc#815 by @serdarucel: retain deterministic shape and PYTHONHASHSEED subprocess coverage with canonical PR OpenMontageInc#597 stable_url_id (16 hexadecimal characters). The cohort preserves the original reviewed heads for OpenMontageInc#594, OpenMontageInc#595, OpenMontageInc#597, OpenMontageInc#639, OpenMontageInc#652, OpenMontageInc#653, OpenMontageInc#779 and OpenMontageInc#857. No audio or Pixabay retry implementations are included.
@calesthio calesthio closed this pull request by merging all changes into OpenMontageInc:main in 82d2601 Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# Pexels stock adapter fails on every request — missing User-Agent header (Cloudflare 401/403)

3 participants