https://github.com/qba73/circleclient
Python client library for CircleCI
https://github.com/qba73/circleclient
circleci client-library python
Last synced: 9 months ago
JSON representation
Python client library for CircleCI
- Host: GitHub
- URL: https://github.com/qba73/circleclient
- Owner: qba73
- License: mit
- Created: 2014-06-23T09:34:07.000Z (over 11 years ago)
- Default Branch: develop
- Last Pushed: 2019-12-02T18:28:37.000Z (about 6 years ago)
- Last Synced: 2025-04-10T07:15:46.615Z (9 months ago)
- Topics: circleci, client-library, python
- Language: Python
- Homepage:
- Size: 69.3 KB
- Stars: 13
- Watchers: 3
- Forks: 11
- Open Issues: 7
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
============
circleclient
============
.. image:: https://travis-ci.org/qba73/circleclient.svg?branch=master
:target: https://travis-ci.org/qba73/circleclient
:alt: Travis CI Build Status
.. image:: https://img.shields.io/pypi/v/circleclient.svg
:target: https://pypi.python.org/pypi/circleclient
:alt: Latest Version
.. image:: https://img.shields.io/pypi/l/circleclient.svg
:target: https://pypi.python.org/pypi/circleclient/
:alt: License
.. image:: https://readthedocs.org/projects/circleclient/badge/?version=latest
:target: http://circleclient.readthedocs.io/en/latest/
:alt: Documentation Status
Python client library for CircleCI API.
Features
========
* 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
Installation
============
.. code:: python
pip install circleclient
Usage
=====
Retrieve information about User
-------------------------------
.. code:: python
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
----------------------------------
.. code:: python
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
-----------------
.. code:: python
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Trigger build
client.build.trigger('', '', '')
Trigger new parametrized build
------------------------------
.. code:: python
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Trigger parametrized build
client.build.trigger('', '', '', ''='')
Cancel running build
--------------------
.. code:: python
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Cancel build
client.build.cancel('', '', '')
Retry build
-----------
.. code:: python
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retry build
client.build.retry('', '', '')
List build artifacts
--------------------
.. code:: python
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# List build artifacts
client.build.artifacts('', '', '')
Retrieve build status
---------------------
.. code:: python
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retrieve build status
client.build.status('', '', '')
Retrieve information about builds across all projects
-----------------------------------------------------
.. code:: python
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=, offset=0)
client.build.recent_all_projects()
Retrieve information about recent build(s)
------------------------------------------
.. code:: python
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('', '', limit='', offset='')
# Retrieve last 10 builds of branch master
client.build.recent('', '', limit=10, branch='master')
# Retrieve last build of branch develop
client.build.recent('', '', branch='develop')
Retrieve filtered information about recent build(s)
---------------------------------------------------
.. code:: python
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(token)
# Retrieve build status and filter results
client.build.recent('',
'',
branch='master',
status_filter='completed')
client.build.recent('',
'',
branch='develop',
status_filter='successful')
client.build.recent('',
'',
limit=10,
status_filter='failed')
client.build.recent('',
'',
status_filter='running')
Clear build cache
-----------------
.. code:: python
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(api_token=token)
# Clear build cache
client.cache.clear(username='', project='')
Use a custom CircleCI endpoint
------------------------------
.. code:: python
import os
from circleclient import circleclient
token = os.environ['API_TOKEN']
client = circleclient.CircleClient(api_token=token, endpoint='https://cci.example.com/api/v1')
# Use client as normal
client.user.info()