Lightweight AWS SigV4 signing and HTTP authentication for httpx, requests, and raw HTTP clients—without the weight of boto3.
Project description
aws-http-auth
Lightweight AWS SigV4 signing and HTTP authentication for httpx, requests, and raw HTTP clients—without the weight of boto3.
Features
- 🚀 Lightweight: No heavy dependencies like boto3—just pure AWS SigV4 signing
- 🔗 Universal: Works with
requests,httpx, and any HTTP client that supports auth handlers - 🔑 Flexible credentials: Load from AWS credentials file, environment variables, or provide directly
- 🎯 Zero config: Automatically detects AWS regions and services from URLs
- 🌐 Pyodide compatible: Works in browser environments with WebAssembly
- 📦 Type safe: Full type hints for better development experience
Table of Contents
Installation
pip install aws-http-auth
Usage Examples
Using requests
from aws_http_auth.credentials import AWSCredentials
from aws_http_auth.http_auth import AWSV4SignerAuth
import requests
creds = AWSCredentials.from_ini_file("~/.aws/credentials")
auth = AWSV4SignerAuth(credentials=creds)
session = requests.Session()
session.auth = auth
response = session.request(
method="POST",
url="https://secretsmanager.us-east-1.amazonaws.com/",
json={
"SecretId": "MyTestDatabaseSecret",
},
headers={
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "secretsmanager.GetSecretValue",
},
)
Using httpx
from aws_http_auth.credentials import AWSCredentials
from aws_http_auth.http_auth import AWSV4SignerAuth
import httpx
creds = AWSCredentials.from_ini_file()
auth = AWSV4SignerAuth(credentials=creds)
async with httpx.AsyncClient(auth=auth) as client:
response = await client.post(
"https://secretsmanager.us-east-1.amazonaws.com/",
json={
"SecretId": "MyTestDatabaseSecret",
},
headers={
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "secretsmanager.GetSecretValue",
},
)
Profile Selection
- If no profile is specified, the library uses the
AWS_PROFILEenvironment variable - If only one profile exists in the credentials file, it's used automatically
- If multiple profiles exist and none is specified, an error is raised
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
aws-http-auth is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aws_http_auth-0.0.2.tar.gz.
File metadata
- Download URL: aws_http_auth-0.0.2.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a9fb6d25606e5fbe052a99a31160b9ae66291ae0face06f843557257330c71c
|
|
| MD5 |
7fcf4422b04def603fde6b4b1c4159ec
|
|
| BLAKE2b-256 |
87f0c3935fa9bdcdcc95150ffad63f0ee3ee7837e8d2040b21bdb145a7b7be75
|
Provenance
The following attestation bundles were made for aws_http_auth-0.0.2.tar.gz:
Publisher:
main.yaml on FlavioAmurrioCS/aws-http-auth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aws_http_auth-0.0.2.tar.gz -
Subject digest:
2a9fb6d25606e5fbe052a99a31160b9ae66291ae0face06f843557257330c71c - Sigstore transparency entry: 342715346
- Sigstore integration time:
-
Permalink:
FlavioAmurrioCS/aws-http-auth@5e53f645c798b0aee2c5927bdb6910647ede09f1 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/FlavioAmurrioCS
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yaml@5e53f645c798b0aee2c5927bdb6910647ede09f1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aws_http_auth-0.0.2-py3-none-any.whl.
File metadata
- Download URL: aws_http_auth-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5aa013c7f54c5063a4098d7b8ee337a867a9cbe6156425b1370c496bda0f81da
|
|
| MD5 |
634b29fa370e2b9b12a9985c745c992a
|
|
| BLAKE2b-256 |
33d08e983a15ddd2ce44c711b1b939e9e56dba5cea48ef1005837f7834b8cf13
|
Provenance
The following attestation bundles were made for aws_http_auth-0.0.2-py3-none-any.whl:
Publisher:
main.yaml on FlavioAmurrioCS/aws-http-auth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aws_http_auth-0.0.2-py3-none-any.whl -
Subject digest:
5aa013c7f54c5063a4098d7b8ee337a867a9cbe6156425b1370c496bda0f81da - Sigstore transparency entry: 342715361
- Sigstore integration time:
-
Permalink:
FlavioAmurrioCS/aws-http-auth@5e53f645c798b0aee2c5927bdb6910647ede09f1 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/FlavioAmurrioCS
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yaml@5e53f645c798b0aee2c5927bdb6910647ede09f1 -
Trigger Event:
push
-
Statement type: