CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-aws-requests-auth

AWS signature version 4 signing process for the python requests module

84

1.10x
Overview
Eval results
Files

task.mdevals/scenario-5/

AWS Request URI Canonicalizer

Build a utility that canonicalizes AWS request URIs for use in AWS Signature Version 4 authentication. The tool should handle both URI path and query string canonicalization according to AWS specifications.

Capabilities

URI Path Canonicalization

Properly formats URI paths with URL encoding.

  • Simple path "/users/profile" returns "/users/profile" @test
  • Empty path "" returns "/" @test
  • Path with spaces "/search/hello world" returns "/search/hello%20world" @test
  • Path with special characters like + and * are properly escaped @test

Query String Canonicalization

Formats query strings by sorting parameters alphabetically. Assumes parameters are already URL-encoded.

  • Empty query string "" returns "" @test
  • Single parameter "name=John" returns "name=John" @test
  • Multiple parameters "b=2&a=1&c=3" returns "a=1&b=2&c=3" (sorted by parameter name) @test
  • Pre-encoded parameters "key=value%20encoded" are preserved correctly @test

Implementation

@generates

API

def canonicalize_path(path: str) -> str:
    """
    Canonicalizes a URI path according to AWS Signature Version 4 specifications.

    Args:
        path: The URI path to canonicalize

    Returns:
        The canonicalized path with proper URL encoding
    """
    pass

def canonicalize_query_string(query: str) -> str:
    """
    Canonicalizes a query string according to AWS Signature Version 4 specifications.
    Assumes query parameters are already URL-encoded.

    Args:
        query: The query string to canonicalize (pre-encoded)

    Returns:
        The canonicalized query string with parameters sorted by name
    """
    pass

Dependencies { .dependencies }

aws-requests-auth { .dependency }

Provides AWS signature version 4 signing process for the python requests module.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-aws-requests-auth

tile.json