Skip to content

Add Pixabay as a stock source for image_find - #28

Merged
IsraelWebDev merged 2 commits into
mainfrom
card/pixabay
Nov 12, 2026
Merged

IsraelWebDev merged 2 commits into
mainfrom
card/pixabay

Conversation

@IsraelWebDev

Copy link
Copy Markdown
Owner

What

Adds Pixabay as the third stock source for image_find, after Pexels and Unsplash. It is used only when PIXABAY_API_KEY is set in the environment.

  • A Pixabay pick is saved to inputs/<name>.jpg with a credit record, like the other sources. Credit line: "Image by [author] on Pixabay".
  • Failed requests raise StockError naming the provider only. The Pixabay key travels in the URL, so the original exception is never passed on.
  • The fallback order is unchanged for people pictures: stock or nothing.

Changed

  • funkbox/studio/stock.py: parse_pixabay, PIXABAY_ORIENTATION, the Pixabay branch in search, provider-only error messages, the key in KEYS.
  • funkbox/studio/tools.py: the image_find description lists the Pixabay key.
  • docs/catalog.json regenerated; docs/studio.md; THIRD_PARTY_NOTICES.md (Pixabay Content Licence).

Tests

  • tests/studio/test_stock_pixabay.py (7 tests, offline): parsing, credit requirement, search order (Pixabay only after Pexels and Unsplash have nothing), the key sent as a query parameter, no key leaked in errors, no call without a key, orientation mapping.
  • Local full run before the last commit: 1283 passed, 13 skipped, 1 failed. The failure was test_p7_hygiene.py::test_no_secrets, which matched a 28-character fake key in the new test. The last commit shortens the fake key to 13 characters. test_p7_hygiene.py and the studio, catalog and server tests now pass (72 passed).

Not in this PR

  • No live Pixabay calls. Live search needs the owner's free key, set locally.
  • Pixabay limits: 100 requests per 60 seconds per key; cache 24 hours; no permanent hotlinking. This PR saves a local copy, which Pixabay allows; the 24-hour expiry is in card/unsplash-cache24h, not here.
  • This branch and card/unsplash-cache24h both touch stock.py, tools.py and docs/studio.md, so the second one to merge will need a merge of main.

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34


Generated by Claude Code

IsraelWebDev and others added 2 commits November 12, 2026 01:43
image_find now searches Pixabay last, after Pexels and Unsplash, when
PIXABAY_API_KEY is set in the environment. Pixabay pictures are saved
locally with a credit record, as the other sources are.

- parse_pixabay reads hits and the 1280 px image; search order is
  Pexels, Unsplash, Pixabay; the first provider with results wins.
- A failed request raises StockError naming only the provider. The
  Pixabay key travels in the URL, so the original exception is never
  passed on.
- Credit wording for Pixabay is "Image by X on Pixabay".
- Catalog regenerated; docs, notices and tool description list the key.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
The full run flagged tests/studio/test_stock_pixabay.py in test_no_secrets:
a 28-character fake key after a SECRET assignment matched the generic
pattern. The value is not a credential, but the test should not need an
exemption. It is now a 13-character fake key.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
@IsraelWebDev
IsraelWebDev merged commit 720f872 into main Nov 12, 2026
4 checks passed
IsraelWebDev pushed a commit that referenced this pull request Nov 12, 2026
Brings in Pixabay (#28). Conflicts in tools.py, studio.md and catalog.json
resolved to keep both the 24-hour expiry and the Pixabay wording; the
catalog was regenerated.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
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.

1 participant