![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
requests-http-message-signatures
Advanced tools
A request authentication plugin implementing IETF HTTP Message Signatures
requests-http-message-signatures 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.
$ pip install requests-http-message-signatures
import requests
from requests_http_signature import HTTPSignatureAuth
preshared_key_id = 'squirrel'
preshared_secret = 'monorail_cat'
url = 'http://example.com/path'
requests.get(url, auth=HTTPSignatureAuth(key=preshared_secret, key_id=preshared_key_id))
By default, only the Date
header is signed (as per the RFC) for body-less requests such as GET. The Date
header
is set if it is absent. In addition, for requests with bodies (such as POST), the Digest
header is set to the SHA256
of the request body and signed (an example of this appears in the RFC). To add other headers to the signature, pass an
array of header names in the headers
keyword argument.
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)
For asymmetric key algorithms, you should supply the private key as the key
parameter to the HTTPSignatureAuth()
constructor as bytes in the PEM format:
with open('key.pem', 'rb') as fh:
requests.get(url, auth=HTTPSignatureAuth(algorithm="rsa-sha256", key=fh.read(), key_id=preshared_key_id))
When verifying, the key_resolver()
callback should provide the public key as bytes in the PEM format as well.
Please report bugs, issues, feature requests, etc. on our issue tracker.
Licensed under the terms of the Apache License, Version 2.0.
FAQs
A request authentication plugin implementing IETF HTTP Message Signatures
We found that requests-http-message-signatures demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.