[英]Why won't my python script work? AttributeError: 'module' object has no attribute 'Pingdom'
So, me and my team uses Pingdom for up time monitoring among other things. 因此,我和我的团队使用Pingdom进行正常运行时间监控。 During our release process Pingdom alerts us that some of our websites are down, which is expected.
在发布过程中,Pingdom会警告我们某些网站已关闭,这是预料之中的。
I would like to automate the process of pausing the necessary Pingdom checks. 我想自动化暂停必要的Pingdom检查的过程。 I have tried the following methods.
我尝试了以下方法。
curl -X PUT -u 'username:Password' -H 'Content-Type: application/json' -H 'App-Key: applicationkey' -d 'paused=true' https://api.pingdom.com/api/2.0/checks/2477066
And followed a guide on how to do the same thing via a Python script (I have very minimal knowledge of Python). 并遵循了有关如何通过Python脚本执行相同操作的指南(我对Python的了解非常少)。
#!/usr/bin/python
import sys
import pingdom
sys.path.append('/home/ec2-user/git-repo/pingdom-cli')
p = pingdom.Pingdom(username='username', password='password', appkey='applicationkey')
p.pause_check('2477066')
As I said my knowledge is very minimal so I'm sure I've done something obviously wrong, any help would be appreciated. 正如我所说的,我的知识非常有限,因此我确定我做错了明显的事情,我们将不胜感激。
Cheers. 干杯。
Instead of import pingdom
use import pingdomlib
as this is the right name of the library. 取而代之的
import pingdom
使用import pingdomlib
因为这是图书馆的正确名称。
import sys
import pingdomlib
...
p = pingdomlib.Pingdom(username='username', password='password', apikey='applicationkey')
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.