Skip to main content

Pydantic models for GitLab Webhooks

PyPI - Version PyPI - Python Version GitHub Release Test suite status

Module containing Pydantic models for validating bodies from GitLab webhook requests.

Documentation

The project documentation including an API reference can be found at https://rjw57.github.io/pydantic-gitlab-webhooks/.

Usage example

Intended usage is via a single validate_event_header_and_body function which will validate an incoming webhook's X-Gitlab-Event header and the body after being parsed into a Python dict.

from pydantic import ValidationError
from pydantic_gitlab_webhooks import (
    validate_event_body_dict,
    validate_event_header_and_body_dict,
)

event_body = {
    "object_kind": "access_token",
    "group": {
        "group_name": "Twitter",
        "group_path": "twitter",
        "group_id": 35,
        "full_path": "twitter"
    },
    "object_attributes": {
        "user_id": 90,
        "created_at": "2024-01-24 16:27:40 UTC",
        "id": 25,
        "name": "acd",
        "expires_at": "2024-01-26"
    },
    "event_name": "expiring_access_token"
}

# Use the value of the "X-Gitlab-Event" header and event body to validate
# the incoming event.
parsed_event = validate_event_header_and_body_dict(
    "Resource Access Token Hook",
    event_body
)
assert parsed_event.group.full_path == "twitter"

# Invalid event bodies or hook headers raise Pydantic validation errors
try:
    validate_event_header_and_body_dict("invalid hook", event_body)
except ValidationError:
    pass  # ok - expected error raised
else:
    assert False, "ValidationError was not raised"

# Event bodies can be parsed without the header hook if necessary although using
# the hook header is more efficient.
parsed_event = validate_event_body_dict(event_body)
assert parsed_event.group.full_path == "twitter"

# Event models may be imported individually. For example:
from pydantic_gitlab_webhooks.events import GroupAccessTokenEvent

parsed_event = GroupAccessTokenEvent.model_validate(event_body)

Metadata

Release files for pydantic-gitlab-webhooks 0.3.54

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-gitlab-webhooks 0.3.54
File Size Uploaded Provenance Actions
pydantic_gitlab_webhooks-0.3.54.tar.gz 9.0 kB With provenance Details for pydantic_gitlab_webhooks-0.3.54.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-gitlab-webhooks 0.3.54
File Interpreter ABI Platform Actions
pydantic_gitlab_webhooks-0.3.54-py3-none-any.whl Python 3 none any Details for pydantic_gitlab_webhooks-0.3.54-py3-none-any.whl

Total release size: 21.6 kB

Release files / pydantic_gitlab_webhooks-0.3.54.tar.gz

Download URL pydantic_gitlab_webhooks-0.3.54.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1afa58192a44c9f53c290b1a24bc47cbdaf370b40f5f4092ecc99481abecd355
BLAKE2b-256 checksum
How to use checksums
222efbee45f835b95ac2470ed86ccb72a5b996cc63cd85331a8be70b8828dafd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / pydantic_gitlab_webhooks-0.3.54-py3-none-any.whl

Download URL pydantic_gitlab_webhooks-0.3.54-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
479f3ac448982fb4582b6046010f6c27d2b9a87567a79eb8feff4438713fe7f6
BLAKE2b-256 checksum
How to use checksums
73351375b477c7753441d4bd0fbebaec50f62c48a073c5d56bcd7e0debb618ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Security for pydantic-gitlab-webhooks 0.3.54

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydantic_gitlab_webhooks-0.3.54.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.54 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page