Python client for CircleCI API
Project description
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
from circleclient 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
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retrieve information about projects
client.projects.list_projects()
Trigger new build
import os
from circleclient 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
from circleclient 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
from circleclient 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
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retry build
client.build.retry('<username>', '<project_name>', '<build_number>')
List build artifacts
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# List build artifacts
client.build.artifacts('<username>', '<project_name>', '<build_number>')
Retrieve build status
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retrieve build status
client.build.status('<username>', '<project_name>', '<build_number>')
Retrieve information about builds across all projects
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retrieve build status
# Default limit=30, offset=0
client.build.recent_all_projects(limit=<int>, offset=0)
client.build.recent_all_projects()
Retrieve information about recent build(s)
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retrieve build status
# Default limit=30, offset=0, branch=None
client.build.recent('<username>', '<project>', limit='<int>', offset='<int>')
# Retrieve last 10 builds of branch master
client.build.recent('<username>', '<project>', limit=10, branch='master')
# Retrieve last build of branch develop
client.build.recent('<username>', '<project>', branch='develop')
Clear build cache
import os
from circleclient 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.4.tar.gz
(6.6 kB
view hashes)
Built Distribution
Close
Hashes for circleclient-0.1.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc3aa38f63524351cb4c61d54221e5065214dfa9e1cc967e4552b4391caaa88d |
|
MD5 | e18dad06094d7e62d2e9720f2b4f8c43 |
|
BLAKE2b-256 | bf470036494f2720a0454afc7b9c8f575fc03fe4271fc063616c41689f1ec47f |