用于IAM授权API的AWS API网关客户端库
apigw-iam-client的Python项目详细描述
AWS API网关IAM授权程序客户端
这为aws api网关客户端提供了一个简单的基类 为http请求提供aws v4请求签名 使用IAM授权的API。
用法
假设rest api端点
fromapigw_iam_clientimportClientclassMyApi(Client):deflist_oranges(self,store_id='all'):returnself.get("%s/oranges"%store_id).json()
>>client=MyApi('bhttps://foix.execute-api.us-east-1.amazonaws.com/dev/')>>client.list_oranges(){'version':'0.1.0','oranges':[]}
客户端还支持通过sts角色获取凭据 通过传递角色arn和可选的 会话名称。