Python wrapper for the SAM.gov (System for Award Management) public API. Provides access to entity registration data, opportunities, exclusions, and other federal procurement data from SAM.gov. Simplifies authentication and pagination when querying the SAM.gov API endpoints.
pip install requestsVerified import paths — ran on the pinned version, not inferred.
Minimal example searching for entity registrations on SAM.gov by keyword.
Register at https://sam.gov and request a public API key. Pass it via SAMClient(api_key='your-key') or set SAM_GOV_API_KEY environment variable.
Implement your own rate limiting or exponential backoff between calls when making bulk queries.
Use 'from sam_gov_api import SAMClient' not 'from sam-gov-api import SAMClient'.
Always use .get() with defaults when accessing nested response fields to avoid KeyError exceptions.
Start pagination from page=1.
It is recommended to use virtual environments (e.g., venv or poetry) for Python projects to manage dependencies cleanly and avoid permission conflicts. Ensure pip is up-to-date and avoid running pip as the 'root' user unless explicitly necessary for system-wide installations (which is generally discouraged for application dependencies).
It is recommended to use a virtual environment instead (https://pip.pypa.io/warnings/venv) or to run pip as a non-root user. Use the --root-user-action option if you understand the risks and want to suppress this warning.