Auth¶
Authentication and credential utilities for AWS.
IamAWSRequestsAuth ¶
IamAWSRequestsAuth(
session=None, service_name="execute-api"
)
Bases: AuthBase
IAM authorizer for signing HTTP requests with AWS SigV4.
This class can be used with the requests library to automatically sign
HTTP requests using AWS IAM credentials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Optional[Session]
|
Optional botocore Session object for credentials. |
None
|
service_name
|
str
|
The AWS service name for signing. Defaults to "execute-api". |
'execute-api'
|
Example
auth = IamAWSRequestsAuth()
response = requests.get(url, auth=auth)
# With custom session and service
auth = IamAWSRequestsAuth(boto3.Session(), 'execute-api')
Source code in src/aibs_informatics_aws_utils/auth.py
32 33 34 35 36 37 38 39 40 41 42 | |