Skip to content

Add ANTICAPTCHA_API_KEY env var fallback for API key#120

Merged
ad-m merged 1 commit intomasterfrom
worktree-groovy-greeting-zebra
Mar 7, 2026
Merged

Add ANTICAPTCHA_API_KEY env var fallback for API key#120
ad-m merged 1 commit intomasterfrom
worktree-groovy-greeting-zebra

Conversation

@ad-m
Copy link
Owner

@ad-m ad-m commented Mar 7, 2026

Summary

  • AnticaptchaClient now accepts client_key as optional; falls back to ANTICAPTCHA_API_KEY env var when not provided
  • Raises AnticaptchaException with CONFIG_ERROR if neither explicit key nor env var is set
  • Documents both approaches in README (auto-included in Sphinx docs)

Test plan

  • test_env_var_fallback — env var is used when no explicit key passed
  • test_explicit_key_over_env — explicit key takes precedence over env var
  • test_no_key_raises — raises AnticaptchaException when neither is set
  • All 29 existing tests pass unchanged

🤖 Generated with Claude Code

Allow AnticaptchaClient to read the API key from the ANTICAPTCHA_API_KEY
environment variable when client_key is not passed explicitly, reducing
hard-coded secrets in source code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ad-m ad-m merged commit 6597b82 into master Mar 7, 2026
6 of 7 checks passed
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