我正在根据主题名验证是否存在主题。在
你知道这是否可能吗?在
例如,我想验证名为“test”的主题是否已经存在。在
下面是我正在尝试的,但不起作用,因为topicsList包含topicArns而不是topicNames。。。在
topics = sns.get_all_topics()
topicsList = topics['ListTopicsResponse']['ListTopicsResult'['Topics']
if "test" in topicsList:
print("true")
Tags:
这是一种黑客攻击,但它应该有效:
如果你有超过100个主题,这个代码就可以工作了
如果您试图捕获
An error occurred (NotFound) when calling the GetTopicAttributes operation: Topic does not exist
异常怎么办?在相关问题 更多 >
编程相关推荐