Skip to main content

Python client for CircleCI API

Project description

circleclient

https://travis-ci.org/qba73/circleclient.svg?branch=master

Python client library for CircleCI API.

Features

  • Retrieve information about user

  • List followed repositories

  • Start build

  • Create parametrized builds

  • List build artifacts

  • Cancel build

  • Retry build

  • Clear build cache

Installation

pip install circleclient

Usage

Retrieve information about User

import os
import circleclient


token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)

# Retrieve User data
client.user.info()

List projects followed by the user

import os
import circleclient


token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)

# Retrieve information about projects
client.projects.list_projects()

Trigger new build

import os
import circleclient

token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)

# Trigger build
client.build.trigger('<username>', '<project_name>', '<branch>')

Trigger new parametrized build

import os
import circleclient

token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)

# Trigger parametrized build
client.build.trigger('<username>', '<project_name>', '<branch>', '<PARAM1>'='<VAL1>')

Cancel running build

import os
import circleclient

token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)

# Cancel build
client.build.cancel('<username>', '<project_name>', '<build_number>')

Retry build

import os
import circleclient

token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)

# Rerty build
client.build.retry('<username>', '<project_name>', '<build_number>')

List build artifacts

import os
import circleclient

token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)

# List build artifacts
client.build.artifacts('<username>', '<project_name>', '<build_number>')

Clear build cache

import os
import circleclient

token = os.environ['API_TOKEN']
client = circleclient.CircleClient(api_token=token)

# Clear build cache
client.cache.clear(username='<username>', project='<project_name>')

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

circleclient-0.1.3.tar.gz (3.8 kB view hashes)

Uploaded Source

Supported by

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