Python client library for CircleCI API.
- Retrieve information about user
- List followed repositories
- Return status of recent builds for given project
- Start build
- Create parametrized builds
- List build artifacts
- Cancel build
- Retry build
- Clear build cache
pip install circleclient
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retrieve User data
client.user.info()
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retrieve information about projects
client.projects.list_projects()
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Trigger build
client.build.trigger('<username>', '<project_name>', '<branch>')
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>')
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>')
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>')
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>')
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>')
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()
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')
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retrieve build status and filter results
client.build.recent('<username>',
'<project>',
branch='master',
status_filter='completed')
client.build.recent('<username>',
'<project>',
branch='develop',
status_filter='successful')
client.build.recent('<username>',
'<project>',
limit=10,
status_filter='failed')
client.build.recent('<username>',
'<project>',
status_filter='running')
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>')