简体   繁体   中英

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. During our release process Pingdom alerts us that some of our websites are down, which is expected.

I would like to automate the process of pausing the necessary Pingdom checks. 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).

    #!/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 sys
import pingdomlib 
...
p = pingdomlib.Pingdom(username='username', password='password', apikey='applicationkey')
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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