Python wrapper for the Buildkite API
Project description
PyBuildkite
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!")
Pagination
Buildkite offers pagination for endpoints that return a lot of data. By default this wrapper return 100
objects. 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 first_page
depending on what page you're on.
builds_response = buildkite.builds().list_all(page=1, with_pagination=True)
# Keep looping until next_page is not populated
while builds_response.next_page:
builds_respose = buildkite.builds().list_all(page=builds_response.next_page, with_pagination=True)
License
This library is distributed under the BSD-style license found in the LICENSE file.
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.
Source Distributions
Built Distribution
Hashes for pybuildkite-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dda68bb3f0ce1a41411abe476cb5355b62e1380f777d9228d10f7e68f72762b0 |
|
MD5 | 8b6b2f223e96544cad460b40da7ea27a |
|
BLAKE2b-256 | b4f222dc1b9fa0f9d7f6ef3bf77c41a6a37edbd0a08ce343e261cd39865d1dcf |