{"id":16061078,"url":"https://github.com/amancevice/requests-iamauth","last_synced_at":"2025-03-18T05:30:30.985Z","repository":{"id":57461352,"uuid":"298664351","full_name":"amancevice/requests-iamauth","owner":"amancevice","description":"Use AWS SigV4 authorization with requests","archived":false,"fork":false,"pushed_at":"2024-03-10T15:34:37.000Z","size":71,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-09T20:47:33.468Z","etag":null,"topics":["api-gateway","aws","iam","sigv4","sigv4a"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amancevice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-25T19:38:35.000Z","updated_at":"2024-12-27T17:04:01.000Z","dependencies_parsed_at":"2024-10-27T17:20:53.165Z","dependency_job_id":"b903c8cc-57d4-40b1-a470-5c98f4d1b976","html_url":"https://github.com/amancevice/requests-iamauth","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"10a20e1c314f1237a789a08c807af9ca68365662"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amancevice%2Frequests-iamauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amancevice%2Frequests-iamauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amancevice%2Frequests-iamauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amancevice%2Frequests-iamauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amancevice","download_url":"https://codeload.github.com/amancevice/requests-iamauth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902293,"owners_count":20366260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-gateway","aws","iam","sigv4","sigv4a"],"created_at":"2024-10-09T04:07:47.383Z","updated_at":"2025-03-18T05:30:30.422Z","avatar_url":"https://github.com/amancevice.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Requests IAMAuth\n\n[![pypi](https://img.shields.io/pypi/v/requests-iamauth?color=yellow\u0026logo=python\u0026logoColor=eee\u0026style=flat-square)](https://pypi.org/project/requests-iamauth/)\n[![python](https://img.shields.io/pypi/pyversions/requests-iamauth?logo=python\u0026logoColor=eee\u0026style=flat-square)](https://pypi.org/project/requests-iamauth/)\n[![pytest](https://img.shields.io/github/actions/workflow/status/amancevice/requests-iamauth/pytest.yml?logo=github\u0026style=flat-square)](https://github.com/amancevice/requests-iamauth/actions/workflows/pytest.yml)\n[![coverage](https://img.shields.io/codeclimate/coverage/amancevice/requests-iamauth?logo=code-climate\u0026style=flat-square)](https://codeclimate.com/github/amancevice/requests-iamauth/test_coverage)\n[![maintainability](https://img.shields.io/codeclimate/maintainability/amancevice/requests-iamauth?logo=code-climate\u0026style=flat-square)](https://codeclimate.com/github/amancevice/requests-iamauth/maintainability)\n\nUse AWS SigV4 authorization with requests.\n\nAccessing an API secured with IAM authorization in AWS API Gateway can be tricky.\n\nThis tool uses the built-in authorization strategy in `requests` to help you access your secured endpoints.\n\n## Installation\n\n```bash\npip install requests-iamauth\n```\n\n## Usage\n\n### Signing Version 4\n\nAWS [sigv4](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) is the current standard for signing requests bound for AWS services.\n\nUse `requests-iamauth` to as an authorizer for the `requests` Python library:\n\n```python\nimport requests\nfrom iamauth import Sigv4Auth\n\nsigv4 = Sigv4Auth(\n  service_name=\"execute-api\",  # default\n)\n\nsession = requests.Session()\nsession.auth = sigv4\nsession.get('https://abcdef0123.execute-api.us-east-2.amazonaws.com/my/api')\n```\n\nOverride the default boto3 session by passing a custom one into the constructor for `Sigv4Auth`:\n\n```python\nimport boto3\n\nsigv4 = Sigv4Auth(\n  boto3_session=boto3.Session(),\n)\n```\n\n### Signing Version 4a\n\nAWS [sigv4a](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) is an extension to the sigv4 signing process that enables signing requests bound for more than one region.\n\n\u003e Note — at the time of this writing, the only API Gateway API type that appears to support the new sigv4a are REST APIs.\n\nUse `requests-iamauth` to as an authorizer for the `requests` Python library:\n\n```python\nimport requests\nfrom iamauth import Sigv4aAuth\n\nsigv4a = Sigv4aAuth(\n  service=\"execute-api\",  # default\n  region=\"*\",             # default\n)\n\nsession = requests.Session()\nsession.auth = sigv4a\nsession.get('https://abcdef0123.execute-api.us-east-2.amazonaws.com/my/api')\n```\n\nOverride the default AWS credentials provider by passing a custom one into the constructor for `Sigv4aAuth`:\n\n```python\nfrom botocore.compat import awscrt\n\nsigv4a = Sigv4aAuth(\n  credentials_provider=awscrt.auth.AwsCredentialsProvider.new_default_chain(),\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famancevice%2Frequests-iamauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famancevice%2Frequests-iamauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famancevice%2Frequests-iamauth/lists"}