我在最新版本的boto3中遇到了一个无属性错误。
就我而言,我引用的是最新的文档(这里——注意URL中的"/api/relatest"(,所以我不知道我做错了什么。
该代码实际上与任何其他boto3客户端调用都没有什么不同:
response = boto3.client('location').search_place_index_for_suggestions(
BiasPosition=response['Results'][0]['Place']['Geometry']['Point'],
FilterCountries=['USA'],
IndexName='CTA-Place-Index',
MaxResults=1,
Text='Major Airport'
)
我知道客户端名称是正确的,因为我在上面的块之前立即进行了类似的调用,如下所示:
response = boto3.client('location').search_place_index_for_text(
FilterCountries=['USA'],
IndexName='CTA-Place-Index',
MaxResults=1,
Text='90210'
)
效果很好。。。
有人有什么想法吗?
更新:没有运气
也许其他人可以运行这个程序,并验证这不仅仅影响我:
client = boto3.client('location')
object_methods = [method_name for method_name in dir(client) if callable(getattr(client, method_name))]
print(object_methods)
";反省;代码:此处
如果您在运行时依赖Lambda提供的SDK,它可能已经过时。Lambda不会在每次发布SDK时立即更新他们的SDK。您可能需要自己包含最新的SDK。请参阅以下知识中心文章。
https://aws.amazon.com/premiumsupport/knowledge-center/lambda-layer-aws-sdk-latest-version/