from jenkinsapi.jenkins import Jenkins
#https://pythonhosted.org/jenkinsapi/using_jenkinsapi.html#example-1-get-version-of-jenkins


jenkins_url='http://localhost:8080';
user='selvan'
password='selvan'
def get_server_instance():
    print "Jenkin Url : "+jenkins_url
    server = Jenkins(jenkins_url, username = user, password = password)
    return server

def get_job_details():
    # Refer Example #1 for definition of function 'get_server_instance'
    server = get_server_instance()
    print get_server_instance().version
    for j in server.get_jobs():
        job_instance = server.get_job(j[0])
#        print 'Job Name:%s' %(job_instance.name)
 #       print 'Job Description:%s' %(job_instance.get_description())
  #      print 'Is Job running:%s' %(job_instance.is_running())
   #     print 'Is Job enabled:%s' %(job_instance.is_enabled())

#if __name__ == '__main__':
 #   print get_server_instance().version
    
get_job_details();    
    