简体   繁体   English

为什么我的python脚本不起作用? AttributeError:“模块”对象没有属性“ Pingdom”

[英]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.

相关问题 无法在PyCharm 5.0中调试Python脚本:AttributeError:“模块”对象没有属性“ default_getpass” - Can't debug Python script in PyCharm 5.0: `AttributeError: 'module' object has no attribute 'default_getpass'` 为什么这个python程序不起作用? AttributeError:“模块”对象没有属性 - Why this python program is not working? AttributeError: 'module' object has no attribute 'AttributeError: 'tuple' 对象没有属性 'lower'' - 为什么 '.lower()' 方法在 Python 中不起作用? - 'AttributeError: 'tuple' object has no attribute 'lower'' - Why doesn't the '.lower()' method doesn't work here in Python? AttributeError:“模块”对象在脚本中没有属性“ _Condition” - AttributeError: 'module' object has no attribute '_Condition' in the script AttributeError:'module'对象没有属性'subscribe'Python - AttributeError: 'module' object has no attribute 'subscribe' Python AttributeError:'module'对象没有属性'call':Python - AttributeError:'module' object has no attribute 'call' :Python Python-> AttributeError:“模块”对象没有属性“主” - Python -> AttributeError: 'module' object has no attribute 'main' python AttributeError:“模块”对象没有属性“ monthcalendar” - python AttributeError: 'module' object has no attribute 'monthcalendar' python 属性错误:“模块”object 没有属性“fft” - python attributeerror: 'module' object has no attribute 'fft' Python AttributeError:“模块”对象没有“连接”属性 - Python AttributeError: 'module' object has no attribute 'connect'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM