--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/5d9056f1-86ab-4d27-a455-66ccb6d32064n%40googlegroups.com.
Hi!
You can use the rundeck API from python. I made a (very) basic example, take a look:
import requests
# host definition
rdeck_instance = "localhost"
rdeck_port = "4440"
rdeck_api = "40"
# connect to instance
s = requests.Session()
r = s.post("http://" + rdeck_instance + ":" + rdeck_port +"/j_security_check", data={"j_username": "admin", "j_password": "admin" })
r.status_code
r.url
# print data (for debug)
print ('######################')
print r.status_code
print r.url
print ('######################')
# job id
jobid = "b47556a2-9721-439b-a70b-c2f2b364571e"
# run a job (you can use any api call here)
r = s.post("http://" + rdeck_instance + ":" + rdeck_port +"/api/" + rdeck_api + "/job/" + jobid + "/run",headers = {'Accept': 'application/json'})
# json response
print(r.json())
Greetings!