requests-sigv4
Python library for making AWS4-HMAC-SHA256 signed calls with requests.
Usage
from requests_sigv4 import Sigv4Request
request = Sigv4Request(region="us-west-2")
response = request.get(
url='{}/pets/1234'.format(API_PATH),
headers={'X-Custom-Header': 'foo-bar'},
)
# Constructor options.
# role_arn can be provided to STS with the current credential context.
Sigv4Request(
region=None,
access_key=None,
secret_key=None,
session_token=None,
session_expires=3600,
profile=None,
role_arn=None,
role_session_name='awsrequest',
service='execute-api')
AWS Credentials
In the background, the credential provider being used is from boto3.
Credentials from environment variables and the AWS shared credential file will work in the same manner they do with boto3 and the AWS command line.
More about boto3 credentials.
Testing
Tests are run using tox. These aren't run as part of the CI due to the AWS credential requirements, so the tests are validated locally.