Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
HTTPSigner
✓ from aws_sdk_signers import HTTPSigner
SigV4Signer
✓ from aws_sdk_signers import SigV4Signer
HttpRequest
✓ from aws_sdk_http import HttpRequest
This example demonstrates how to sign a simple AWS S3 GET request using SigV4. It dynamically resolves AWS credentials and region, constructs an `HttpRequest` object, and then applies the SigV4 signature using `SigV4Signer`. Note that `x-amz-content-sha256` for an empty body is explicitly set, and `botocore` is used for credential resolution.
import os
from datetime import datetime, timezone
from aws_sdk_signers import SigV4Signer
from aws_sdk_http import HttpRequest
import botocore.session
# 1. Resolve AWS credentials and region (e.g., from environment variables, ~/.aws/credentials)
session = botocore.session.get_session()
credentials = session.get_credentials()
# Use os.environ.get for region, falling back to botocore config or a default
region = os.environ.get('AWS_DEFAULT_REGION', session.get_config_variable('region') or 'us-east-1')
# Ensure credentials and region are found
if not credentials or not credentials.access_key or not region:
raise RuntimeError("AWS credentials or region not found. Set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN (optional) and AWS_DEFAULT_REGION.")
# 2. Create an HTTP Request object
# For an empty body, x-amz-content-sha256 must be the SHA256 hash of an empty string.
request = HttpRequest(
method="GET",
scheme="https",
host="example.s3.amazonaws.com",
path="/myobject.txt",
headers={
"Host": "example.s3.amazonaws.com",
"x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
body=b''
)
# 3. Create a SigV4Signer instance
signer = SigV4Signer(
credentials=credentials,
service_id="s3",
region=region,
)
# 4. Sign the request
signing_date = datetime.now(timezone.utc) # Use a timezone-aware datetime for signing
signed_request = signer.sign(request, signing_date)
print("--- Original Request Headers ---")
for k, v in request.headers.items():
print(f"{k}: {v}")
print("\n--- Signed Request Headers ---")
for k, v in signed_request.headers.items():
print(f"{k}: {v}")
print(f"\nSigned Authorization header: {signed_request.headers.get('Authorization')}")
Upgrade
Version history
0.3.0latest on PyPI · released May 5, 2026
Audit
Dependencies
botocoreoptionalCommonly used for resolving AWS credentials and regions programmatically.
aws-sdk-httpoptionalProvides the HttpRequest and HttpResponse objects that are typically used with signers.