Universal (sync/async) Python client for Jenkins
Project description
Python client for Jenkins which supports both sync and async syntax with same interface.
Comparison to other packages |
|||
---|---|---|---|
Name |
Sync |
Async |
Python |
YES |
YES |
3.6+ |
|
NO |
YES |
3.5+ |
|
YES |
NO |
3.4+ |
|
YES |
NO |
3.4+ |
Installation
Latest release from PyPI
pip3 install ujenkins
Or latest developing version
pip3 install git+https://github.com/pbelskiy/ujenkins
Usage
Get Jenkins version using sync client:
from ujenkins import JenkinsClient
def example():
client = JenkinsClient('http://server', 'user', 'password')
version = client.system.get_version()
print(version)
example()
With async client (be careful AsyncJenkinsClient must be called inside async function):
import asyncio
from ujenkins import AsyncJenkinsClient
async def example():
client = AsyncJenkinsClient('http://server', 'user', 'password')
version = await client.system.get_version()
print(version)
asyncio.run(example())
Examples
Get timestamp of latest build of speciefic job.
Build number or some of standard tags could be used here:
lastBuild
lastCompletedBuild
lastFailedBuild
lastStableBuild
lastSuccessfulBuild
lastUnstableBuild
lastUnsuccessfulBuild
from ujenkins import JenkinsClient
client = JenkinsClient('http://server', 'user', 'password')
client.builds.get_info('job', 'lastBuild')['timestamp']
Documentation
Testing
Prerequisites: tox
Then just run tox, all dependencies and checks will run automatically
tox
Contributing
Any contributions are welcome!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.