Basic API request signing
Project description
A very simple library to help generate signed requests.
INSTALLATION
pip install apysigner
USAGE
For a GET request
>>> import apysigner >>> private_key = 'UHJpdmF0ZSBLZXk=' >>> url = 'http://www.example.com/api-endpoint?q=find+my+thing' >>> apysigner.get_signature(private_key, url) 'zMxf77eY-xuORInBIA0azhxHPg2bzhsjz-huP-OuYKk='
For a POST request
>>> import apysigner >>> private_key = 'UHJpdmF0ZSBLZXk=' >>> payload = {'do': 'something', 'name': 'Johnny'} >>> url = 'http://www.example.com/api-endpoint' >>> apysigner.get_signature(private_key, url, payload) 'CFNmvPrjW_Z1x5XO-tQzJzhs6GjeJH0k0SxOuuhJ3YA='
Just the basics to create the HMAC signature. You’ll need combine this with other things like actually adding the signature on the URL and making the request, but those responsibilities intentionally live elsewhere.
See the django-request-signer project for examples if you need the rest.
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
apysigner-4.0.0.tar.gz
(3.7 kB
view details)
Built Distribution
File details
Details for the file apysigner-4.0.0.tar.gz
.
File metadata
- Download URL: apysigner-4.0.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e9b540b71d2e4980f95980f95a1a65cfe4f8faceaf92cef6e67f6ee5a391c84 |
|
MD5 | 0cf216c49fbb815e8581c4b9e593e380 |
|
BLAKE2b-256 | ed6525c7557689f801e1ae1c409ccdb698ab02df342f9bf611dff9aea27c65de |
File details
Details for the file apysigner-4.0.0-py3-none-any.whl
.
File metadata
- Download URL: apysigner-4.0.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fa4986f93cf07c57003e00b6b3e16463984ca1273067ab5639553bce4eb299d |
|
MD5 | d90fa021179d3d6ac3e6899f8a96c077 |
|
BLAKE2b-256 | 2c737a7900dd2b549825edf55851467d81e556f4005141bb6754b0065b7e7177 |