简体   繁体   English

Credstash:“模块”对象没有属性“ get”:AttributeError

[英]Credstash: 'module' object has no attribute 'get': AttributeError

I am trying to use credstash for accessing credentials stored in KMS, however, even before accessing them, the python 2.7 lambda runtime on aws is giving me an error: 我正在尝试使用credstash访问存储在KMS中的凭据,但是,即使在访问它们之前,aws上的python 2.7 lambda运行时也给我一个错误:

'module' object has no attribute 'get': AttributeError
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 12, in lambda_handler
    print '%s' %(credstash.get('tv.forecaster.dev.cms.username'))
AttributeError: 'module' object has no attribute 'get'

As there is hardly any info out there, i am struggling with this problem in vain. 由于几乎没有任何信息,我徒劳地解决了这个问题。 If anyone can help me solve the problem, I will be highly grateful. 如果有人能帮助我解决问题,我将不胜感激。 Following is my requirements.txt: 以下是我的requirements.txt:

credstash==1.13.1
cryptography==2.0.3

I am accessing my credentials like this: 我正在这样访问我的凭据:

import credstash

string cred = credstash.get('name_of_the_stored_cred_in_dynamodb')

is the way i am accessing the credential using credstash wrong? 我使用credstash访问凭证的方式是否错误?

I realized the error when i read the source code of credstash.py. 当我阅读credstash.py的源代码时,我意识到了该错误。 Basically it is credstash.getSecret('name_of_cred') and not .get() . 基本上是credstash.getSecret('name_of_cred')而不是.get() It worked magically thereafter. 此后它神奇地工作。 Also, I had to package it on a amazon linux container instead of mac 另外,我必须将其打包在亚马逊linux容器而不是mac上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM