Python wrapper for the Buildkite API
Low maintenance activity. Last release 16 months ago, commits in 1 of the last 26 weeks. Weaker on commit activity and recent releases.
Consider insteadcheckmk-dev-toolsPythie’s Index: 7520.4K downloads/moCompare →
pip install pybuildkitePyBuildkite
A Python library and client for the Buildkite API.
Usage
To get the package, execute:
pip install pybuildkite
Then set up an instance of the Buildkite object, set you access token, and make any available requests.
from pybuildkite.buildkite import Buildkite, BuildState
buildkite = Buildkite()
buildkite.set_access_token('YOUR_API_ACCESS_TOKEN_HERE')
# Get all info about particular org
org = buildkite.organizations().get_org('my-org')
# Get all running and scheduled builds for a particular pipeline
builds = buildkite.builds().list_all_for_pipeline('my-org', 'my-pipeline', states=[BuildState.RUNNING, BuildState.SCHEDULED])
# Create a build
buildkite.builds().create_build('my-org', 'my-pipeline', 'COMMITSHA', 'master',
clean_checkout=True, message="My First Build!")
Per-Page Configuration
The per_page parameter controls the number of items returned per API request. This can be useful for organizations with large datasets that experience timeouts.
# Default behavior (100 items per page)
buildkite = Buildkite()
# Custom per_page for smaller responses (useful for large organizations)
buildkite = Buildkite(per_page=25)
Pagination
Buildkite offers pagination for endpoints that return a lot of data. By default this wrapper returns 100 objects per page. However, any request that may contain more than that offers a pagination option.
When with_pagination=True, we return a response object with properties that may have next_page, last_page, previous_page, or depending on what page you're on.