Skip to main content

Implements WebSub X-Hub-Signature authentication for the Python Requests library

Project description

requests-websub-auth

A micro-library providing WebSub HMAC Signature authentication for webhooks.

The HMAC signature is generated using a secret and the webhook body. It is placed in the X-Hub-Signature header in the format <algorithm>=<hmac_signature>, where the hmac_signature is a hexdigest.

Supports all of the algorithms detailed in the WebSub specification.

Installation

pip install requests-websub-auth

Usage

import requests
from requests_websub_auth import WebSubAuth, WebSubAlgorithm

auth = WebSubAuth("secret", WebSubAlgorithm.SHA256)
payload = {
    "foo": 1,
    "bar": 2
}

response = requests.post("https://foobar.com/", auth=auth, json=payload)
response.raise_for_status()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests-websub-auth-0.0.5.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

requests_websub_auth-0.0.5-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page