skillfed

pygitguardian

Python Wrapper for GitGuardian's API -- Scan security policy breaks everywhere

pygitguardian v1.33.1 391.2K downloads/30d#7,016 on PyPI89
Permissive license MIT Active released

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 pygitguardian

uv

uv add pygitguardian

poetry

poetry add pygitguardian

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Security

Tags

gitguardian api clientsecret detection librarysecrets scanning pythonsecurity vulnerability detectiondevsecops api integrationcredential leak detectiontext content scanning
secrets-detectiondevsecopsapi-client

More Security packages