Skip to main content

support scs >=2.4.0 client lib for python

Project description

scs lib for python3

from pyscs.scs import SCS

scs = SCS()
# set script can be stop right now
msg, code = scs.can_stop()
if code == 200:
    print("success")
elif code == 201:
    print("warning: " + msg)
else:
    print(msg)

# set script can not be stop except exec scs.can_stop()
msg, code = scs.can_not_stop()
if code == 200:
    print("success")
elif code == 201:
    print("warning: " + msg)
else:
    print(msg)


from pyscs.script import Script
# add script or server
s = Script("test", "python test.py")
# When dir is not empty and is not exist and get is not empty, It will command get first
s.dir = "/home/test"
s.get = "cd /home && git clone xxxx"
msg, code = scs.add_script(s)
if code == 200:
    print("success")
elif code == 201:
    print("warning: " + msg)
else:
    print(msg)

# del script or server on scsd
# test is pname
msg, code = scs.del_script("test")
if code == 200:
    print("success")
elif code == 201:
    print("warning: " + msg)
else:
    print(msg)



# set alert like add script

a = Alert()
# When dir is not empty and is not exist and get is not empty, It will command get first
a.pname = "alert"
a.name = "test"
a.title = "some thing broken"
a.broken = True
a.reason = "error"
msg, code = scs.set_alert(a)
if code == 200:
    print("success")
elif code == 201:
    print("warning: " + msg)
else:
    print(msg)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyscs-0.0.6.tar.gz (3.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page