如何将布尔值(由函数返回)传递给boto3 put_item()函数

时间:2019-03-30 19:03:15

标签: python-3.x amazon-dynamodb boto3

我有一个功能,

def _get_package_(sandboxId):

    for i in response_tci_sandboxes['Items']:
            if sandboxId == i['id']['S']:
                    if i.get('sandboxType') == 'operational':
                            return True  ## Please note that true(lowercase) is not allowed
                    else:
                            return False

    return 1

现在的问题是,当我将上述函数返回的值传递给put_item函数时,抛出了错误,因为它期望布尔值是小写的,即true或false。

我试图用这种东西。

 str(_get_package_(sandboxId)).lower

但是put_item将其作为字符串放入,由于数据类型为BOOL,因此请求被拒绝。

0 个答案:

没有答案