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-9/

AWS Request Canonicalizer

Build a utility that canonicalizes HTTP request components according to AWS Signature Version 4 specifications. The utility should properly format URI paths and query strings for use in AWS request signing.

Requirements

Your implementation should handle:

  1. Canonical Path Generation: Convert URI paths to their canonical form following AWS specifications

    • Empty paths should default to /
    • Special characters must be properly URL-encoded
    • Path components should be normalized
  2. Canonical Query String Generation: Process query parameters into canonical form

    • Parameters must be sorted alphabetically by key
    • Both keys and values should be properly formatted
    • Handle empty query strings correctly
    • Support multiple parameters with various characters

Test Cases

  • Given an empty path "", the canonical path should be "/" @test
  • Given a path "/search/documents", the canonical path should preserve it as "/search/documents" @test
  • Given a path with special characters "/files/my document.pdf", special characters should be properly encoded @test
  • Given an empty query string "", the canonical query string should be "" @test
  • Given a query string with one parameter "search=test", it should be preserved as "search=test" @test
  • Given multiple parameters "zebra=last&apple=first&banana=middle", they should be sorted alphabetically by key: "apple=first&banana=middle&zebra=last" @test

Implementation

@generates

API

def get_canonical_path(path: str) -> str:
    """
    Convert a URI path to its canonical form for AWS request signing.

    Args:
        path: The URI path to canonicalize

    Returns:
        The canonical path string
    """
    pass

def get_canonical_querystring(query: str) -> str:
    """
    Convert a query string to its canonical form for AWS request signing.
    Query parameters should be sorted alphabetically by key.

    Args:
        query: The query string to canonicalize

    Returns:
        The canonical query string
    """
    pass

Dependencies { .dependencies }

aws-requests-auth { .dependency }

Provides canonical request formatting utilities for AWS request signing.

@satisfied-by

Version

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