requests-http-signature: A Requests auth module for HTTP Signature ================================================================== **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 `_. .. code-block:: python 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: .. code-block:: python 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. Links ----- * `IETF HTTP Signatures draft `_ * `Project home page (GitHub) `_ * `Documentation (Read the Docs) `_ * `Package distribution (PyPI) `_ * `Change log `_ Bugs ~~~~ Please report bugs, issues, feature requests, etc. on `GitHub `_. License ------- Licensed under the terms of the `Apache License, Version 2.0 `_. .. image:: https://travis-ci.org/kislyuk/requests-http-signature.png :target: https://travis-ci.org/kislyuk/requests-http-signature .. image:: https://codecov.io/github/kislyuk/requests-http-signature/coverage.svg?branch=master :target: https://codecov.io/github/kislyuk/requests-http-signature?branch=master .. image:: https://img.shields.io/pypi/v/requests-http-signature.svg :target: https://pypi.python.org/pypi/requests-http-signature .. image:: https://img.shields.io/pypi/l/requests-http-signature.svg :target: https://pypi.python.org/pypi/requests-http-signature .. image:: https://readthedocs.org/projects/requests-http-signature/badge/?version=latest :target: https://requests-http-signature.readthedocs.org/