Ctrl + K
DocumentationLog inGet started

tessl/pypi-aws-requests-auth

tessl install tessl/pypi-aws-requests-auth@0.4.0

AWS 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%

task.mdevals/scenario-8/

AWS Request Authenticator

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.

Requirements

Your implementation should provide a function that:

  1. Makes authenticated GET and POST requests to AWS Elasticsearch Service endpoints
  2. Properly handles empty request bodies (typical for GET requests)
  3. Correctly processes string request bodies (JSON data as strings)
  4. Correctly processes bytes request bodies (binary data)
  5. Uses AWS credentials to sign requests with proper payload hashing

The function should accept AWS credentials, endpoint information, HTTP method, and optional body data, then return the HTTP response.

Test Cases

  • Making a GET request with no body to an AWS ES endpoint returns a successful response @test
  • Making a POST request with an empty string body to an AWS ES endpoint includes correct content hash @test
  • Making a POST request with JSON string body '{"query": "test"}' includes correct content hash @test
  • Making a POST request with bytes body b'{"data": "binary"}' includes correct content hash @test

Implementation

@generates

API

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
    """
    pass

Dependencies { .dependencies }

aws-requests-auth { .dependency }

Provides AWS signature version 4 authentication and payload handling capabilities.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/aws-requests-auth@0.4.x
tile.json