Skip to content

Instantly share code, notes, and snippets.

@ran-isenberg
Last active May 4, 2024 08:54
Show Gist options
  • Save ran-isenberg/1457d12a7e1d35df85122c0c48e291f2 to your computer and use it in GitHub Desktop.
Save ran-isenberg/1457d12a7e1d35df85122c0c48e291f2 to your computer and use it in GitHub Desktop.
sigv4.py
import boto3
import requests
from aws_requests_auth.aws_auth import AWSRequestsAuth
session = boto3.Session()
credentials = session.get_credentials()
auth = AWSRequestsAuth(
aws_access_key=credentials.access_key,
aws_secret_access_key=credentials.secret_key,
aws_token=credentials.token,
aws_host='[Service C API GW host]',
aws_region=session.region_name,
aws_service='execute-api',
)
requests.get('[service C API url]', timeout=10, auth=auth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment