python-squarelet
Python library that handles token authentication for MuckRock and DocumentCloud
What it is and what it does
python-squarelet is a Python client library that wraps the Squarelet authentication system used by MuckRock and DocumentCloud. It handles the complexity of token-based authentication, automatic token refresh, rate limiting, and request retry logic so you don't have to manage these concerns manually. The library provides a simple SquareletClient class that you initialize with credentials and a base API URI, then use to make HTTP requests (GET, POST, PUT, DELETE, etc.) to MuckRock or DocumentCloud APIs.
The package is designed for developers who need to programmatically interact with MuckRock Requests or DocumentCloud through their APIs. It abstracts away authentication token management, applies rate limiting automatically to respect API quotas, and includes built-in retry logic for transient failures. The library also provides custom exception classes for different error scenarios (API errors, credential issues, missing resources), making error handling more explicit in your code.
Use it for:
- Automate document retrieval and metadata queries from DocumentCloud using Python scripts.
- Build applications that submit and track FOIA requests through MuckRock's API programmatically.
- Create batch processing pipelines that interact with MuckRock or DocumentCloud without managing authentication tokens manually.
- Integrate MuckRock or DocumentCloud data into data analysis workflows or reporting systems.
- Develop bots or scheduled tasks that monitor or update resources in MuckRock or DocumentCloud systems.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Python client library for authenticating with and making API requests to MuckRock and DocumentCloud services, handling token management, rate limiting, and automatic retries.
Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively. Install it if you need to programmatically access MuckRock or DocumentCloud APIs—it eliminates boilerplate around authentication, token refresh, and rate limiting. The narrow scope (specific to Squarelet-based services) means it's only useful if you're targeting those particular APIs.
Install
python-squarelet on PyPI
pip
pip install python-squareletuv
uv add python-squareletpoetry
poetry add python-squareletInstalling python-squarelet
Before you install
Low friction installation as a pure Python wheel. Active maintenance with a release on 2026-08-14 and last commit the same day. Three lightweight runtime dependencies (ratelimit, requests, urllib3) are all widely-used and stable.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute the package freely with minimal restrictions.
Quickstart
pip install python-squarelet
from squarelet import SquareletClient
import os
username = os.environ["SQ_USERNAME"]
password = os.environ["SQ_PASSWORD"]
client = SquareletClient(base_uri="https://api.www.documentcloud.org/api/", username=username, password=password)
response = client.request("get", "users/me/")
print(response.text)
Requires Python 3.8 or later (capped at 3.12). Credentials must be provided via environment variables or constructor parameters.
Verify before relying
- Whether rate limiting configuration is customizable beyond the automatic application mentioned in the description.
- Whether the package handles token refresh transparently across concurrent requests or only sequentially.
- Performance characteristics and typical latency overhead from the rate limiting and retry logic.
Package facts
| License | not declared (permissive) |
| Python support | capped below the current Python release (<=3.12,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — ratelimit, requests, urllib3 |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 240,127/month — #8,911 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_squarelet-0.4.0-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
apiclientA lightweight framework for building HTTP API…
permissive · top 15,000 on PyPI
python-documentcloudA Python wrapper for the DocumentCloud API that…
permissive · top 15,000 on PyPI
requests-oauth2clientAn OAuth 2.x client for Python that obtains,…
permissive · top 5,000 on PyPI
marketorestpythonPython client library that wraps the Marketo…
permissive · top 15,000 on PyPI
oauth2-clientHandles OAuth2 authentication flows…
unclear · top 15,000 on PyPI
coze-workload-identityImplements OAuth2.0 token exchange…
permissive · top 15,000 on PyPI
veracode-api-pyProvides a Python wrapper for Veracode REST…
permissive · top 15,000 on PyPI
jellyfin-apiclient-pythonPython client library for interacting with…
copyleft · top 15,000 on PyPI
sharepyHandles authentication to SharePoint Online and…
copyleft · top 15,000 on PyPI
PureCloudPlatformClientV2Python client library for the Genesys Cloud…
permissive · top 5,000 on PyPI