开发者

Python append boolean with another dictionary

def upd_secrets(self, secret_name, secret_value):
    response_per_region = {}
    upd_status = {}
    update_response = None
    allSuccess = True
    for region, client in self.client.items():
        try:
            update_secrets = {'SecretId': name}
            if isinstance(secret_value, str):
                update_secrets["SecretString"] = value
            elif isinstance(secret_value, bytes):
                update_secrets["SecretBinary"] = value
            update_response = client.update_secret(**update_secrets)
            if update_response:
                response_per_region[region] = update_response
**                upd_status = {**allSuccess, **response_per_region[region]}
**        except Exception as e:
            allSuccess = False
            logging.error(f'Could not update {name} in {region}. Error: {e}')
    return upd_status

In the above code, I am trying to append bool with dict, but unable to do the update or using **..

Output for

upd_status = {"allSuccess": True, "response_per_region": {}}.

Any pointers on how to append/merge allSuccess and with response_per_region?

I have tried update and ** to append the bool and dict which is erroring out -

boolean cannot be mapped.output for upd_statu开发者_运维百科s = {"allSuccess": True, "response_per_region": {}}.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜