fingerprint_client: read the key from .env, like everything else does - #12
Merged
Conversation
`--key` defaulted to `os.environ.get("TWOCAPTCHA_KEY")` alone, so a key put
in `.env` — exactly as §3, the README and .env.example instruct — worked for
every engine and failed HERE with "No API key". A documented mechanism not
applied on one path, which is the shape of half the defects §16 lists. Found
on a sibling repo's first live --fingerprint run, then checked across the
family before patching: five repos had it, one had already fixed it.
The fix reads through `env_config.env_value` rather than `os.environ.get`,
and that choice is measured rather than stylistic. With
TWOCAPTCHA_KEY=your_2captcha_api_key_here exported:
os.environ.get sends the placeholder to the API; the run reports
"Fingerprint API rejected the key (401) — note this is a
separate subscription", sending the reader off to check a
subscription they never needed
env_value "TWOCAPTCHA_KEY is still set to the placeholder from
.env.example — treating it as unset"
`load_env()` is called here rather than relied upon, because this is a
standalone entry point that no engine has necessarily run first.
Pinned by a check that was verified to FAIL on the old code: that it loads
.env itself, that it reads through the loader, that it does NOT read
os.environ directly, that a placeholder still reads as unset, and that the
help string does not interpolate the default — which is one substring away
from printing a live credential to anyone who types --help.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--keydefaulted toos.environ.get("TWOCAPTCHA_KEY")alone, so a key putin
.env— exactly as §3, the README and.env.exampleinstruct — workedfor every engine and failed here with "No API key". A documented
mechanism not applied on one path, which is the shape of half the defects
§16 lists.
Found on a sibling repo's first live
--fingerprintrun, then checkedacross the family before patching, per §16: five repos had it, one
(catawiki) had already fixed it. This is that fix, made identical everywhere.
Why
env_valueand notos.environ.getMeasured both ways with
TWOCAPTCHA_KEY=your_2captcha_api_key_hereexported:os.environ.getFingerprint API rejected the key (401) — note this is a separate subscription from captcha solvingenv_valueTWOCAPTCHA_KEY is still set to the placeholder from .env.example — treating it as unsetThe first sends the reader off to check a subscription they never needed.
load_env()is called here rather than relied upon, because this is astandalone entry point that no engine has necessarily run first.
Pinned
A new check, verified to fail on the old code by reverting: that it loads
.envitself, that it reads through the loader, that it does not reados.environdirectly, that a placeholder still reads as unset, and that thehelp string does not interpolate its default — which is one substring away
from printing a live credential to anyone who types
--help.Offline suite green,
--helpworks,ci_checks.py --allpasses.🤖 Generated with Claude Code