[英]use boto3 command as a string
We can use boto3
package to get the data from mTurk account (or do anything else in AWS). 我们可以使用
boto3
包从mTurk帐户获取数据(或在AWS中执行其他任何操作)。 For example: 例如:
client = boto3.client('mturk')
balance = client.get_account_balance()
Is there a way to use boto3 command as a string? 有没有办法将boto3命令用作字符串? Something like:
就像是:
balance = client.get_command('get_account_balance')
get_command
is totally just for illustrative purposes here of course. get_command
完全只是出于说明目的。
使用getattr
内置函数:
getattr(client, 'get_account_balance')()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.