pygitguardian
Python Wrapper for GitGuardian's API -- Scan security policy breaks everywhere
What it is and what it does
py-gitguardian is a Python wrapper around GitGuardian's API that lets you scan text content for secrets and security vulnerabilities. It handles the HTTP communication and response parsing, exposing methods like `content_scan()` for single documents and `multi_content_scan()` for batch operations. The library uses marshmallow for request/response serialization and includes model classes that can be converted to JSON or dictionaries.
You typically use it to integrate secret detection into CI/CD pipelines, pre-commit hooks, or custom scanning workflows. The client requires an API key and supports health checks to validate credentials before scanning. Results are returned as structured objects that expose detected secrets, their severity, and remediation guidance.
Use it for:
- Scan code repositories or files in CI/CD pipelines to prevent secrets from being committed
- Integrate secret detection into pre-commit hooks to catch credentials before they reach version control
- Build custom security scanning tools that check multiple data sources (logs, config files, chat exports) for leaked credentials
- Validate API keys and check GitGuardian service health before running large batch scans
- Automate compliance checks by scanning application configuration or deployment artifacts for hardcoded secrets
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
API client library for GitGuardian's secret detection service, enabling detection of over 200 types of secrets and security vulnerabilities in text content.
Yes. Active maintenance, no known vulnerabilities, low install friction, and permissive MIT license make this a safe choice. Install it if you need to integrate GitGuardian's secret detection into Python workflows—it's the official client and used by GitGuardian Shield itself. Requires a valid API key and internet access to the GitGuardian service.
Install
pygitguardian on PyPI
pip
pip install pygitguardianuv
uv add pygitguardianpoetry
poetry add pygitguardianInstalling pygitguardian
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with a release 17 days ago and no known vulnerabilities. Depends on standard libraries (requests, marshmallow) with clear deprecation messaging for Python 3.8 support.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install pygitguardian
from pygitguardian import GGClient
import os
api_key = os.getenv("GITGUARDIAN_API_KEY")
client = GGClient(api_key=api_key)
if client.health_check().success:
result = client.content_scan("your text to scan")
Requires a valid GitGuardian API key (obtain from dashboard.gitguardian.com). Python 3.8+ required; Python 3.8 support is deprecated.
Verify before relying
- Rate limits or quota constraints on the GitGuardian API itself (not documented in this fact sheet)
- Whether the 200+ secret types detection covers all common credential formats relevant to your use case
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — marshmallow, requests, marshmallow-dataclass, typing-extensions, setuptools |
| Maintenance | actively maintained — 17 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 391,201/month — #7,016 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygitguardian-1.33.1-py3-none-any.whl
Keywords: api-client, devsecops, secrets-detection, security-tools, library, gitguardian
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
ggshieldggshield is a CLI tool that scans files,…
permissive · top 15,000 on PyPI
pybacklogpyPyBacklogPy wraps the Backlog API to let you…
permissive · top 5,000 on PyPI
detect-secretsDetects secrets (API keys, tokens, credentials)…
permissive · top 5,000 on PyPI
bc-detect-secretsDetects secrets (API keys, tokens, credentials)…
permissive · top 5,000 on PyPI
truffleHogScans Git repositories and other sources for…
unclear · top 15,000 on PyPI
kingfisher-binKingfisher is a command-line secret scanner…
permissive · top 15,000 on PyPI
safetySafety CLI scans Python project dependencies…
permissive · top 5,000 on PyPI
uv-secureScans uv.lock, pylock.toml, and…
permissive · top 15,000 on PyPI
guarddogGuardDog is a CLI tool that scans PyPI, npm,…
permissive · top 15,000 on PyPI
vt-pyOfficial Python client for the VirusTotal REST…
permissive · top 15,000 on PyPI