python-jenkins抓取jenkins网页信息

pip install python-jenkins

vi aa.py

#!/usr/bin/python

#coding:utf-8

import jenkins

server = Jenkins('http://10.0.1.2:8080/jenkins', username='ming', password='xxxxxx')

print(server.jobs_count()) (显示job个数)

print(server.get_nodes()) (显示所有slave)

nodes = server.get_nodes()
print(len(nodes)) (显示slave个数,有带master)

print(server.keys())
print(server.get_jobs_list()) (显示jenkins上所有job信息)

:wq

python aa.py