Python check value of list matches to an items substring in the list -


i have python method check values match subtring of item in list.

def readvalues(bucket_name,key_name,region,param_value):  # status of bucket readprop = [] decrypted_data = []  exists_bucket = check_bucket_exist(bucket_name) exists_key = check_key_exist(bucket_name,key_name)  if exists_bucket == true , exists_key == true:     cipher_text_blob=read_artifact(bucket_name,key_name)     decrypted_data = (decrypt_data(cipher_text_blob,region).decode("utf-8")).split()      print (decrypted_data) param in param_value:     data in decrypted_data:         if param in data:         readprop.append('data')         return readprop     else:         print ("provided prameter not on file.") 

value being passed main function

param_value= [event['secretlist']] print (readvalues(bucket_name,key_name,region,param_value)) 

here secretlist event pasess value below json output

  "secretlist": ["githubtoken","githubuser"] 

contents on plain text file githubtoken=1234 githubuser=abc

if items in secret list matches list items on file should ouptut value of parameter

here if githubtoken exist on file pass "1234" output variable


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -