def delete_job():
jenkins_url = sys.argv[1]
auth = 'Basic ' + base64.encodestring('%s:%s' % ('gopal.singh', '221c13db5d90f39cd987eb20b1deed09'))[:-1]
if jenkins_url[-1] != '/': jenkins_url += '/'
print 'HELLO: ' + jenkins_url
api_url = jenkins_url + 'doDelete'
#api_url = jenkins_url + 'api/json'
get_post = None # '' for POST: None for GET
req = urllib2.Request(api_url, get_post)
req.add_header('Authorization', auth)
return urllib2.urlopen(req).read() # POST method if two args
No comments:
Post a Comment