Skip to content

fix: read the CourtListener token from a file when the variable is unset - #24

Merged
markramm merged 1 commit into
mainfrom
fix/courtlistener-token-file
Oct 10, 2026
Merged

markramm merged 1 commit into
mainfrom
fix/courtlistener-token-file

Conversation

@markramm

Copy link
Copy Markdown
Owner

What

courtlistener now looks for the token in COURTLISTENER_TOKEN, then in ~/.config/courtlistener/token (XDG_CONFIG_HOME respected; COURTLISTENER_TOKEN_FILE overrides 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 courtlistener still 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

…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>
@markramm
markramm merged commit bd0c4ef into main Oct 10, 2026
3 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