Skip to content

Releases: awslabs/aws-sdk-python-signers

v0.0.2

03 Jun 20:11
Compare
Choose a tag to compare

0.0.2

Feature

  • Added new content_checksum_enabled parameter to SigV4SigningProperties.

    This will enable users to control the inclusion of the X-Amz-Content-SHA256
    header required by S3. This is disabled by default, so you will need to
    set this to True for any S3 requests.

Bugfixes

  • Fixed incorrect exclusion of X-Amz-Content-SHA256 header from some requests.

v0.0.1

24 May 02:51
Compare
Choose a tag to compare

0.0.1 (2024-05-23)

Features

  • Added SigV4Signer to sign arbitrary requests sychronously.
  • Added AsyncSigV4Signer to sign arbitrary requests asychronously.
  • Added example SigV4Auth for integrating directly with Requests’
    auth parameter.
  • Added SigV4Signer for integrating with the AIOHTTP request
    workflow.
  • Added SigV4Curl for generating signed curl commands.

Getting Started

The general premise of the library is to allow portable SigV4 signing implementations that can be integrated with any HTTP Client using Python. With the release of 0.0.1, we support signing for AIOHTTP, Curl, and Requests through their native auth interfaces. These are intended to serve as proofs of concept for how the signing library can be ported elsewhere for easy integration with existing applications without the need for a whole SDK.

from os import environ

import requests

from examples import requests_signer
from aws_sdk_signers import SigV4SigningProperties, AWSCredentialIdentity

SERVICE="lambda"
REGION="us-west-2"

# A GET request to this URL performs a "ListFunctions" invocation.
# Full API documentation can be found here:
# https://docs.aws.amazon.com/lambda/latest/api/API_ListFunctions.html
URL='https://lambda.us-west-2.amazonaws.com/2015-03-31/functions/'

# Set up our signing properties and identity
signing_properties = SigV4SigningProperties(region=REGION, service=SERVICE)
identity = AWSCredentialIdentity(
        access_key_id=environ["AWS_ACCESS_KEY_ID"],
        secret_access_key=environ["AWS_SECRET_ACCESS_KEY"],
        session_token=environ.get("AWS_SESSION_TOKEN"),
)

# Configure the auth class for signing
sigv4_auth = requests_signer.SigV4Auth(signing_properties, identity)

>>> r = requests.get(URL, auth=sigv4_auth)
>>> print(r.json())
{'Functions': [{'Description': '', 'TracingConfig': {'Mode': 'PassThrough'}, 'VpcConfig': ... 'NextMarker': None}