This package will generate AWS V4 authentication Signature for http 1.1 request.
Project description
Introduction
This package generate http 1.1 AWS Signature Version 4 Authentication headers.
Function Arguments
argument name | data type | default value | description |
---|---|---|---|
service | str | service name | |
region | str | region name | |
access_key | str | access key | |
secret_key | str | secret key | |
url | str | http request url | |
httpMethod | str | standard http 1.1 method | |
canonicalHeaders | dict | AWS Service required headers | |
otherHeaders | dict | other non-mandatory headers | |
queryString | str | '' | |
payload | str | '' | valid payload |
Function retrun value
The return value data type is dict and including AWS Signature Version 4 Authentication headers.
Demo Code
from awsv4sign import generate_http11_header
import requests
import json
service = 'execute-api'
region = 'cn-north-1'
access_key = ''
secret_key = ''
session_token = ''
url = ''
httpMethod = 'post'
canonicalHeaders = {}
otherHeaders = {'x-api-key': '', 'content_type': 'application/json' ,'x-amz-security-token': session_token}
queryString = ''
payload = {}
result = requests.post(url, data=json.dumps(payload), headers=generate_http11_header(service, region, access_key, secret_key, url, 'post', canonicalHeaders, otherHeaders, queryString, json.dumps(payload)))
print(result.json())
Generated http 1.1 heards could be used by pycurl, urllib3 and so on packages.
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
aws_v4_signature-2.0.tar.gz
(7.8 kB
view details)
Built Distribution
File details
Details for the file aws_v4_signature-2.0.tar.gz
.
File metadata
- Download URL: aws_v4_signature-2.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25ce22b05219302ffcb2db79463daa1c3c7f46d9c161f5b5181630318f739b73 |
|
MD5 | 1c2f66402e57bfd616614bd70c9c79e1 |
|
BLAKE2b-256 | 1c39e5b843dcc8ee54f324619cc7d57bea73403b15810a2771eec2962522a97d |
File details
Details for the file aws_v4_signature-2.0-py3-none-any.whl
.
File metadata
- Download URL: aws_v4_signature-2.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8ab92eac0b89a99c8b3e1e869ecaf84fbc3535ebf9603177d8acd71295aade5 |
|
MD5 | 3ea7aa2ffa26043288859ad468e83403 |
|
BLAKE2b-256 | 5b61dc796d19a1f1d7aab02bf8615e264aa0f11ae159ef875a730b8a03f7792f |