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.
Links
Bugs
Please report bugs, issues, feature requests, etc. on GitHub.
License
Licensed under the terms of the Apache License, Version 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file requests-http-signature-0.0.2.tar.gz
.
File metadata
- Download URL: requests-http-signature-0.0.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bb0dafac543c9765c8273f22db5b8f6d8ddb013d3bccccf2383afc2674e57ef |
|
MD5 | a944010217fb54c192e876dd1b856d84 |
|
BLAKE2b-256 | ca6d13f6ed8a3888488528e2ce8bc4902420ae81ccb6e2d95f191ba8d6e8dfad |
File details
Details for the file requests_http_signature-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: requests_http_signature-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56327eab9d2139918499d607edde5d0a0ac21322f5334b76b55ddd9feee2ac7e |
|
MD5 | b9c11816334d3e6149846f640f5ec271 |
|
BLAKE2b-256 | 1a19d6243ed640fd0c2e84b0d67c9184bd0e7cc31c3cc1b036470e008c2db11b |