Skip to main content

Jenkins Python Client

Project description

Unit Test Integration Test CodeQL Coverage Status codecov PyPI PyPI - Python Version PyPI - Wheel Documentation Status GitHub

Jenkins Python Client

Python3 client library for Jenkins API.

Features

  • Object oriented, each Jenkins item has corresponding class, easy to use and extend
  • Base on api/json, easy to query/filter attribute of item
  • Setup relationship between class just like Jenkins item
  • Support api for almost every Jenkins item
  • Pythonic
  • Test with latest Jenkins LTS

Installation

python3 -m pip install api4jenkins

Quick start

>>> from api4jenkins import Jenkins
>>> client = Jenkins('http://127.0.0.1:8080/', auth=('admin', 'admin'))
>>> client.version
'2.176.2'
>>> xml = """<?xml version='1.1' encoding='UTF-8'?>
... <project>
...   <builders>
...     <hudson.tasks.Shell>
...       <command>echo $JENKINS_VERSION</command>
...     </hudson.tasks.Shell>
...   </builders>
... </project>"""
>>> client.create_job('path/to/job', xml)
>>> import time
>>> item = client.build_job('path/to/job')
>>> while not item.get_build():
...      time.sleep(1)
>>> build = item.get_build()
>>> for line in build.progressive_output():
...     print(line)
...
Started by user admin
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/freestylejob
[freestylejob] $ /bin/sh -xe /tmp/jenkins2989549474028065940.sh
+ echo $JENKINS_VERSION
2.176.2
Finished: SUCCESS
>>> build.building
False
>>> build.result
'SUCCESS'

Documentation

User Guide and API Reference is available on Read the Docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

api4jenkins-1.15.0.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

api4jenkins-1.15.0-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file api4jenkins-1.15.0.tar.gz.

File metadata

  • Download URL: api4jenkins-1.15.0.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for api4jenkins-1.15.0.tar.gz
Algorithm Hash digest
SHA256 ef1c06a3782cdc21f91b9aca734baf933cbb41da9e12d2bde5fa4eacd2a65541
MD5 58e2e787f438c53a56bbe71c6b06cc20
BLAKE2b-256 63905564fa332681a3868b6a75e221acefd8971b02ab3ee1809730bc17e90ca5

See more details on using hashes here.

File details

Details for the file api4jenkins-1.15.0-py3-none-any.whl.

File metadata

  • Download URL: api4jenkins-1.15.0-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for api4jenkins-1.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5bf2fbcf44a9fc95fc22e8f9e1e39bfab02d4e447a15f25ec0616200437044dd
MD5 3e3ec791930291546e326b56ac83ada9
BLAKE2b-256 1730e8b37581cad86af830f4267e7881dcd9310a1422f83ebf4adad7ba7a412f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page