tessl install tessl/pypi-aws-requests-auth@0.4.0AWS signature version 4 signing process for the python requests module
Agent Success
Agent success rate when using this tile
84%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.11x
Baseline
Agent success rate without this tile
76%
Build a utility that generates AWS authentication headers for HTTP requests to AWS services using the AWS Signature Version 4 signing process.
Create a module that constructs a complete set of AWS authentication headers for a given HTTP request. The utility should accept request details and AWS credentials, then return a dictionary of headers ready to be attached to an HTTP request.
Your implementation should:
The header generation function should accept:
aws_access_key: AWS access key ID (string)aws_secret_access_key: AWS secret access key (string)aws_host: AWS service endpoint hostname (string)aws_region: AWS region code (string)aws_service: AWS service name (string)method: HTTP method (string, e.g., "GET", "POST")path: Request path (string)params: Query parameters (dict, optional)data: Request body/payload (string or bytes, optional)aws_token: AWS session token (string, optional)Return a dictionary with string keys and string values containing all necessary AWS authentication headers.
@generates
def generate_aws_headers(
aws_access_key: str,
aws_secret_access_key: str,
aws_host: str,
aws_region: str,
aws_service: str,
method: str,
path: str,
params: dict = None,
data: str = None,
aws_token: str = None
) -> dict:
"""
Generate AWS Signature Version 4 authentication headers.
Args:
aws_access_key: AWS access key ID
aws_secret_access_key: AWS secret access key
aws_host: AWS service endpoint hostname
aws_region: AWS region code (e.g., 'us-east-1')
aws_service: AWS service name (e.g., 'es', 'execute-api')
method: HTTP method (e.g., 'GET', 'POST')
path: Request path
params: Query parameters (optional)
data: Request body/payload (optional)
aws_token: AWS session token for temporary credentials (optional)
Returns:
Dictionary of AWS authentication headers ready to attach to HTTP request
"""
passProvides AWS Signature Version 4 authentication for HTTP requests.
@satisfied-by