$ show LibraryOfCongress/api.congress.gov
This repository provides the official documentation, OpenAPI specification, and client libraries for the Congress.gov API (v3), a public REST API that exposes U.S. federal legislative data including bills, amendments, members, committees, hearings, nominations, treaties, and Congressional Record content. The repo is primarily a supporting asset for the API, containing detailed endpoint documentation in Markdown, a machine-readable OpenAPI spec (openapi.yaml/json), and example client implementations in Java and Python. The Python client (cdg_client.py) demonstrates a reusable pattern with dynamic HTTP method dispatch, session management, and optional keyring-based API key storage. The Java client (CDGClient.java) uses java.net.http.HttpClient and a config file reader. The repository does not contain the actual API server implementation; it is a companion repository for developers integrating with the Congress.gov API. The codebase is well-structured, actively maintained (as evidenced by the changelog), and the documentation is comprehensive, though some minor typos exist. The duplicate client directories (java/ and api_client/java/, python/ and api_client/python/) suggest some organizational drift, but the core components are solid.
The LLM identified 3 files worth highlighting for reuse:
A reusable Python client class (CDGClient) that wraps the Congress.gov API. It uses requests.Session for connection pooling, dynamic __getattr__ to map HTTP methods (get, post, etc.), and supports both JSON and XML responses. It includes error handling hooks and optional integration with the OS keyring for secure API key storage. This pattern can be extracted and adapted for any REST API with minimal modification.
A reusable Java client class that uses java.net.http.HttpClient to interact with the Congress.gov API. It reads configuration (API key, base URL, format) from a properties file via the Config class, appends query parameters, and handles response output to file or console. The design is clean and modular, demonstrating a config-driven API client pattern suitable for extraction into other projects.
A comprehensive OpenAPI 3.0 specification for the Congress.gov API, defining over 50 endpoints with request parameters, response schemas, and authentication. It uses consistent patterns for pagination (offset/limit), filtering (fromDateTime/toDateTime), and schema reuse via $ref. This spec is a valuable reusable asset for generating client libraries, API documentation, or integration tests for any legislative data application.