Jenkins provides a full set of REST APIs for its functionalities: https://wiki.jenkins.io/display/JENKINS/Remote+access+API. There are also a number of Python wrappers that make the interaction even easier. Let's take a look at the Python-Jenkins package:
$ sudo pip3 install python-jenkins$ python3>>> import jenkins>>> server = jenkins.Jenkins('http://192.168.2.123:8080', username='<user>', password='<pass>')>>> user = server.get_whoami()>>> version = server.get_version()>>> print('Hello %s from Jenkins %s' % (user['fullName'], version))Hello Admin from Jenkins 2.121.2
We can work with the management of the server, such as plugins:
>>> plugin = server.get_plugins_info()>>> plugin[{'supportsDynamicLoad': 'MAYBE', 'downgradable': ...