Skip to content

Instantly share code, notes, and snippets.

@monester
Created June 8, 2016 11:09
Show Gist options
  • Save monester/c914e32e7a2c729474700ae8f185c7bc to your computer and use it in GitHub Desktop.
Save monester/c914e32e7a2c729474700ae8f185c7bc to your computer and use it in GitHub Desktop.
import requests
import lxml.etree as etree
def pp(url):
responce = requests.get(url, auth=auth)
if responce.status_code == 200:
content = responce.content
print etree.tostring(etree.fromstring(content), pretty_print = True)
else:
print "Invalid responce, code=%s, url=%s" % (responce.status_code, url)
auth = None
jenkins_api = 'https://ci.fuel-infra.org/api/xml/?'
pp(jenkins_api +"tree=jobs[name,builds[number,result]]&" +
"xpath=hudson/job[name='10.0-community.all']/build[result='SUCCESS']/&wrapper=builds")
pp(jenkins_api + "tree=jobs[name,builds[number,result,url,actions[parameters[name,value]]]]&" +
"xpath=hudson/job[name='publish_fuel_community_iso']/build[result='SUCCESS']/action/parameter[value='10.0']" + \
"&wrapper=builds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment