Skip to main content

Python wrapper for the Buildkite API

Project description

PyBuildkite Build status Coverage Status

pypi pypi

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_response = 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


Download files

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

Source Distribution

pybuildkite-1.0.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

pybuildkite-1.0.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file pybuildkite-1.0.0.tar.gz.

File metadata

  • Download URL: pybuildkite-1.0.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for pybuildkite-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c02125f309d89ac95e40ff04eac36b45043957cc4c2ba1f92c272e7df588df73
MD5 5cd47f412b7e4aab363c205a25aac9c5
BLAKE2b-256 ad70fc97e4c8792f6f6fb12895b237269aa69ba5d8c5b4d93109da0f5a60fd31

See more details on using hashes here.

File details

Details for the file pybuildkite-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pybuildkite-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for pybuildkite-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 724c77e9f179ea68b560c0294f2a43579e8ac34961ec0a35582cb9ddfa6caa28
MD5 594e56d44ae6c62fad77c87b53e0061a
BLAKE2b-256 10e41eb38ce1447e4cd4d02b87a0532501ee882097c2375845c57306aa5b0def

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