python - Verify if a topic exists based on topic name -


i'm trying verify if topic exists based on topic name.

do know if possible?

for example want verify if topic name "test" exist.

below i'm trying doesn't work because topicslist contains topicarns , not topicnames...

topics = sns.get_all_topics()    topicslist = topics['listtopicsresponse']['listtopicsresult'['topics']  if "test" in topicslist:     print("true") 

this kind of hack should work:

topics = sns.get_all_topics()    topic_list = topics['listtopicsresponse']['listtopicsresult']['topics'] topic_names = [t['topicarn'].split(':')[5] t in topic_list]  if 'test' in topic_names:    print(true) 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -