“Python-jenkins”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
(创建页面,内容为“=Example 1: Get version of Jenkins= This is an example showing how to connect to a Jenkins instance and retrieve the Jenkins server version. <pre> import jenkins s…”)
 
第1行: 第1行:
 +
pip3 install python-jenkins
 +
 
=Example 1: Get version of Jenkins=
 
=Example 1: Get version of Jenkins=
 
This is an example showing how to connect to a Jenkins instance and retrieve the Jenkins server version.
 
This is an example showing how to connect to a Jenkins instance and retrieve the Jenkins server version.
第14行: 第16行:
  
 
</pre>
 
</pre>
 +
 +
=R=
 +
 +
https://python-jenkins.readthedocs.io/en/latest/examples.html

2021年9月30日 (四) 01:26的版本

pip3 install python-jenkins

Example 1: Get version of Jenkins

This is an example showing how to connect to a Jenkins instance and retrieve the Jenkins server version.


import jenkins

server = jenkins.Jenkins('http://localhost:8080', username='myuser', password='mypassword')
user = server.get_whoami()
version = server.get_version()
print('Hello %s from Jenkins %s' % (user['fullName'], version))

#Hello 运维 from Jenkins 2.263.1


R

https://python-jenkins.readthedocs.io/en/latest/examples.html