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 library that authenticates HTTP requests to AWS services using AWS Signature Version 4.
Your library should provide functionality to sign HTTP requests using AWS credentials (access key ID and secret access key) following the AWS Signature Version 4 signing process. The authenticator should integrate with the Python requests library and add the necessary authentication headers to outgoing requests.
The authenticator should:
requests library as an authentication handler@generates
class AWSRequestAuth:
"""
Authenticates HTTP requests using AWS Signature Version 4.
This class integrates with the requests library to automatically
sign HTTP requests with AWS credentials.
"""
def __init__(self, aws_access_key, aws_secret_access_key, aws_host,
aws_region, aws_service, aws_token=None):
"""
Initialize the AWS request authenticator.
Args:
aws_access_key: AWS access key ID
aws_secret_access_key: AWS secret access key
aws_host: AWS service host (e.g., 'es.us-east-1.amazonaws.com')
aws_region: AWS region (e.g., 'us-east-1')
aws_service: AWS service name (e.g., 'es', 'execute-api')
aws_token: Optional session token for temporary credentials
"""
pass
def __call__(self, request):
"""
Sign the request and add authentication headers.
This method is called by the requests library when this
authenticator is used as the auth parameter.
Args:
request: A requests PreparedRequest object
Returns:
The modified request with authentication headers added
"""
passProvides AWS Signature Version 4 signing functionality for HTTP requests.
@satisfied-by