Skip to main content

A Requests auth module for HTTP Signature

Project description

requests-http-signature is a Requests authentication plugin (requests.auth.AuthBase subclass) implementing the IETF HTTP Signatures draft RFC. It has no required dependencies outside the standard library. If you wish to use algorithms other than HMAC (namely, RSA and ECDSA algorithms specified in the RFC), there is an optional dependency on cryptography.

import requests
from requests_http_signature import HTTPSignatureAuth
preshared_secret = 'monorail_cat'
url = 'http://example.com/path'
requests.get(url, auth=HTTPSignatureAuth(key=preshared_secret, key_id='squirrel'))

In addition to signing messages in the client, the class method HTTPSignatureAuth.verify() can be used to verify incoming requests:

def key_resolver(key_id, algorithm):
    return 'monorail_cat'

HTTPSignatureAuth.verify(request, key_resolver=key_resolver)

Installation

pip install requests-http-signature

Asymmetric key algorithms (RSA and ECDSA)

For asymmetric key algorithms, you should supply the private key as the key parameter to the HTTPSignatureAuth() constructor as bytes in the PEM format. When verifying, the key_resolver() callback should provide the public key as bytes in the PEM format as well.

License

Licensed under the terms of the Apache License, Version 2.0.

https://travis-ci.org/kislyuk/requests-http-signature.png https://codecov.io/github/kislyuk/requests-http-signature/coverage.svg?branch=master https://img.shields.io/pypi/v/requests-http-signature.svg https://img.shields.io/pypi/l/requests-http-signature.svg https://readthedocs.org/projects/requests-http-signature/badge/?version=latest

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-http-signature-0.0.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

requests_http_signature-0.0.2-py2.py3-none-any.whl (6.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file requests-http-signature-0.0.2.tar.gz.

File metadata

File hashes

Hashes for requests-http-signature-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2bb0dafac543c9765c8273f22db5b8f6d8ddb013d3bccccf2383afc2674e57ef
MD5 a944010217fb54c192e876dd1b856d84
BLAKE2b-256 ca6d13f6ed8a3888488528e2ce8bc4902420ae81ccb6e2d95f191ba8d6e8dfad

See more details on using hashes here.

File details

Details for the file requests_http_signature-0.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for requests_http_signature-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 56327eab9d2139918499d607edde5d0a0ac21322f5334b76b55ddd9feee2ac7e
MD5 b9c11816334d3e6149846f640f5ec271
BLAKE2b-256 1a19d6243ed640fd0c2e84b0d67c9184bd0e7cc31c3cc1b036470e008c2db11b

See more details on using hashes here.

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