pygitguardian is the official Python client library for the GitGuardian API, allowing developers to detect over 200 types of secrets and other security vulnerabilities in text content. It is actively developed with frequent releases, currently at version 1.29.0.
pip install pygitguardianVerified import paths — ran on the pinned version, not inferred.
Initializes the GGClient with an API key sourced from an environment variable and performs a content scan for secrets. It includes a health check and prints detected incidents. API keys should always be handled securely, ideally via environment variables, to prevent exposure.
Migrate any code using these deprecated endpoints to alternative GitGuardian API methods or tools, or ensure your application does not rely on these specific functionalities.
Consult the latest pygitguardian documentation or examples for `scan_and_create_incidents()` to ensure correct usage with the updated API.
Update type hints and any logic that processes these fields to expect string values. Perform explicit type conversions if a non-string type is required by your application.
Before accessing `policy_break.detector_name` or `policy_break.detector_group_name`, check if the value is `None` to prevent `AttributeError` or unexpected behavior.
Ensure your GitGuardian API key is correctly set as the `GITGUARDIAN_API_KEY` environment variable or passed directly to the `GGClient` constructor. You can verify the key's validity using `client.health_check()`.
Install the library using pip: `pip install pygitguardian` or `pip3 install --upgrade pygitguardian`.
Reduce the frequency of API calls, implement retry logic with exponential backoff, or contact GitGuardian support to discuss increasing your API quota limits.