Skip to main content

Requests AWS IAM Auth

An AWS IAM authentication package for Requests. Supported services: API Gateway v1. This is intended for use in production environments at the 1.0 release.

Example

API Gateway v1

import requests
import requests_aws_iam_auth

# Provide AWS creds and config per Boto3 specs: https://tknk.io/ri3v
auth = requests_aws_iam_auth.ApiGateway()

requests.get("https://p7xw90rcx4.execute-api.us-east-1.amazonaws.com/s/", auth=auth)

Developer Information

Dependencies

Botocore

Headers

authorization, and x-amz-content-sha256 are directly modified in the signing protocal and will be set.

Expect for authorization, connection, expect, user-agent, x-amz-content-sha256, x-amz-security-token and x-amzn-trace-id all user set headers are signed.

If the user does not specify host it is derived and signed.

If the method is not GET, HEAD, or OPTIONS, has a payload, and the user does not provide a content-length header it is derived and signed.

If there's a Date header, we set the date header. Otherwise, we set the X-Amz-Date header.

The underlying http.client will derive an unsigned accept-encoding header if not user specified.

If using STS x-amz-security-token will be set by this library.

Payload

The payload is always signed using SHA 256.

Protocols

HTTP and HTTPS 1.1 are supported.

Python

Latest three minor versions of python will be supported.

Contributor Notes

This library uses botocore for signing.

Requests uses urllib3 which uses http.client.

Botocore relies on http.client deriving the host when absent. Botocore replacates this deravation and signs with it but does not append the header to the sent request. This has the potential for a mismatch error. There is a TODO in botocore to set the host header in the request.

Maintainers

Core

Mateus Amin and Benton Drew

API Gateway v1

Mateus Amin and Benton Drew

Some Other Service

????

References

TODO

  • Add testing of three most recent python versions. Use docker not tox. No reason to bloat the stack.
  • Add fuzzing?
  • Add CI build. Keep it portable and deterministic.
  • Support AWS API Gateway v2 if it adds IAM Auth as a feature. Same for HTTP2.
  • Add Requests v3 support.
  • connection header. The connection header is set to blank between post auth and the server signing (inclusive). Could be a AWS, Requests, urllib3, botocore, or http.client. Have ruled out botocore. Can rule out the urllib3 and http.client by reading the sent request on the wire. As a temporary workaround we do not sign it.

Metadata

Release files for requests-aws-iam-auth 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for requests-aws-iam-auth 0.2.0
File Size Uploaded
requests_aws_iam_auth-0.2.0.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for requests-aws-iam-auth 0.2.0
File Interpreter ABI Platform
requests_aws_iam_auth-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / requests_aws_iam_auth-0.2.0.tar.gz

Download URL requests_aws_iam_auth-0.2.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8cc20e840f90805272e1f853a35e5a9febbd64a71faedc212dabeb956cf5e273
BLAKE2b-256 checksum
How to use checksums
6cd6cfc0e8a8a723bddbe0ae54fced8389ac80b9a00c9d66624a9a04c3294b29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

Release files / requests_aws_iam_auth-0.2.0-py3-none-any.whl

Download URL requests_aws_iam_auth-0.2.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a8fae4612f230e4d77014d2b4ea3589faded0f4fe2a4a1ae02fac8c6e391385
BLAKE2b-256 checksum
How to use checksums
f6015a90401ad7692a5861f27ad9ea1d12a03c69d4e31f6198efe1ea5847f365
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page