aiohttp-aws-auth
Overview
This module provides AWS Signature Version 4 (SigV4) authentication for aiohttp through two primary middleware classes:
AwsSigV4Auth: For direct AWS credential authenticationAwsSigV4AssumeRoleAuth: For authentication using AWS IAM Role assumption
Features
- Simple integration with aiohttp
- Support for both synchronous and asynchronous authentication
- AWS SigV4 signing for API requests
- IAM Role assumption with configurable duration
- Credential expiration and automatic refresh
- Flexible configuration options
Installation
Install the package using pip:
pip install aiohttp-aws-auth
Usage
Basic AWS Credentials Authentication
import aiohttp
from aiohttp_aws_auth import AwsSigV4Auth, AwsCredentials
# Create AWS credentials
credentials = AwsCredentials(
access_key='YOUR_ACCESS_KEY',
secret_key='YOUR_SECRET_KEY'
)
# Create an authentication middleware
aws_auth_middleware = AwsSigV4Auth(
credentials=credentials,
region='us-west-2',
service='execute-api',
)
# Make a request
async with ClientSession(middlewares=(aws_auth_middleware,)) as session:
resp = await session.get("https://your-api-endpoint.com")
IAM Role Assumption
import aioboto3
from aiohttp_aws_auth import AwsSigV4AssumeRoleAuth
# Create async AWS session
session = aioboto3.Session()
# Create an authentication middleware
aws_auth_middleware = AwsSigV4AssumeRoleAuth(
region='us-west-2',
role_arn='arn:aws:iam::123456789012:role/YourRole',
session=session,
duration=timedelta(hours=1),
)
# Make an async request
async with ClientSession(middlewares=(aws_auth_middleware,)) as session:
resp = await session.get("https://your-api-endpoint.com")
Configuration Options
AwsSigV4Auth
credentials: AWS credentials objectregion: AWS regionservice: AWS service name (default: 'execute-api')
AwsSigV4AssumeRoleAuth
region: AWS regionrole_arn: IAM Role ARN to assumeservice: AWS service name (default: 'execute-api')session: Synchronous boto3 sessionasync_session: Asynchronous aioboto3 sessionduration: Credential validity duration (default: 1 hour)refresh_buffer: Time before expiration to refresh credentials (default: 0 seconds)
Dependencies
- aiohttp
- aioboto3 (only needed when using AwsSigV4AssumeRoleAuth)
Metadata
Release files for aiohttp-aws-auth 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiohttp_aws_auth-0.0.3.tar.gz | 4.0 kB | With provenance | Details for aiohttp_aws_auth-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiohttp_aws_auth-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for aiohttp_aws_auth-0.0.3-py3-none-any.whl |
Total release size: 8.7 kB
Release files / aiohttp_aws_auth-0.0.3.tar.gz
| Download URL | aiohttp_aws_auth-0.0.3.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f6ec3078ab7a96998340a2266c5265b06af4e72a4557913756155714dc8a048
|
|
BLAKE2b-256 checksum How to use checksums |
4446ff23276027a7c084f474431fe89f58a33dee04d8fe853014440350c0e4b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency logRelease files / aiohttp_aws_auth-0.0.3-py3-none-any.whl
| Download URL | aiohttp_aws_auth-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd3c2a052876dad29c1c30f7f7fc85649f2f95bc0365012abaa572c704727aa4
|
|
BLAKE2b-256 checksum How to use checksums |
749c5ad77d95982f62fc506b57ed024e742bfb0a2416463a85fe69df59702c31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency logSecurity for aiohttp-aws-auth 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for aiohttp_aws_auth-0.0.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.