AWS signature version 4 signing process for the python requests module
84
Build a utility that makes authenticated HTTP requests to AWS services with proper payload handling. The utility should handle different types of request bodies and ensure they are correctly signed using AWS Signature Version 4.
Your implementation should provide a function that:
The function should accept AWS credentials, endpoint information, HTTP method, and optional body data, then return the HTTP response.
@generates
def make_authenticated_request(method, url, aws_access_key, aws_secret_key,
aws_region, aws_service, body=None):
"""
Makes an authenticated HTTP request to an AWS service.
Parameters:
- method (str): HTTP method ('GET' or 'POST')
- url (str): Full AWS service endpoint URL
- aws_access_key (str): AWS access key ID
- aws_secret_key (str): AWS secret access key
- aws_region (str): AWS region (e.g., 'us-east-1')
- aws_service (str): AWS service name (e.g., 'es')
- body (str, bytes, or None): Request body content
Returns:
requests.Response: HTTP response object
"""
passProvides AWS signature version 4 authentication and payload handling capabilities.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-aws-requests-authdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10