【发布时间】:2021-09-10 03:21:08
【问题描述】:
我正在使用 boto3 文档 (https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/iam.html#IAM.Client.get_account_authorization_details) 中提供的代码和此代码:
import boto3
import boto3.session
my_session = boto3.session.Session(profile_name='US-Prod')
client = my_session.client('iam')
response = client.get_account_authorization_details(
Filter=[
'User'|'Role'|'Group'|'LocalManagedPolicy'|'AWSManagedPolicy',
],
MaxItems=123,
Marker='string'
)
产生这个错误:
Exception has occurred: TypeError
unsupported operand type(s) for |: 'str' and 'str'
File "C:\Users\bg216063\Documents\AWS\sre-scripts\excel\mkIAMxls.py", line 9, in <module>
'User'|'Role'|'Group'|'LocalManagedPolicy'|'AWSManagedPolicy',
当我从文档示例中复制和粘贴后,为什么不支持这些类型?
【问题讨论】:
-
|表示它至少是这些值之一。例如,尝试指定Filter=["User"]。
标签: python amazon-web-services boto3