Repository navigation
fix: read the CourtListener token from a file when the variable is unset - #24
Merged
Merged
Conversation
…when the variable is unset A token exported from a login profile never reaches agent tool shells, cron or cloud setup scripts, so calls ran on the anonymous tier while the caller believed they were authenticated. The variable still wins when set; COURTLISTENER_TOKEN_FILE overrides the path. Co-Authored-By: Claude Opus 5.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.
What
courtlistenernow looks for the token inCOURTLISTENER_TOKEN, then in~/.config/courtlistener/token(XDG_CONFIG_HOMErespected;COURTLISTENER_TOKEN_FILEoverrides the path). The variable wins when both are set. An empty variable or file sends no header, as before.Why
A token exported from a login profile reaches login shells only. Agent tool shells, cron and cloud setup scripts start without it, so every call ran unauthenticated without saying so: 401s on the docket endpoints and the anonymous rate limits.
Tests
tests/test_courtlistener_token.py: six cases (no token, file only, variable over file, blank variable, empty file, explicit path). Full suite passes locally. Checked live from a shell with the variable unset: an authenticated docket read succeeds.Not in this change
The limiter policy for
courtlistenerstill encodes the free tier (5/min, 50/hr, 125/day). A paid membership has higher limits; making the policy configurable is a separate change.🤖 Generated with Claude Code