# pycircleci
[![PyPI version](https://img.shields.io/pypi/v/pycircleci?color=blue)](https://python.org/pypi/pycircleci)
[![Build Status](https://github.com/alpinweis/pycircleci/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/alpinweis/pycircleci/actions/workflows/test.yml?query=branch%3Amaster)
Python client for [CircleCI API](https://circleci.com/docs/2.0/api-intro/).
Based on the discontinued [circleci.py](https://github.com/levlaz/circleci.py) project.
## Features
- Supports [API v1.1](https://circleci.com/docs/api/#api-overview) and [API v2](https://circleci.com/docs/api/v2/)
- Supports both `circleci.com` and self-hosted [Enterprise CircleCI](https://circleci.com/enterprise/)
## Installation
$ pip install pycircleci
## Usage
Create a personal [API token](https://circleci.com/docs/2.0/managing-api-tokens/#creating-a-personal-api-token).
Set up the expected env vars:
CIRCLE_TOKEN # CircleCI API access token
CIRCLE_API_URL # CircleCI API base url. Defaults to https://circleci.com/api
```python
from pycircleci.api import Api, CIRCLE_TOKEN, CIRCLE_API_URL
circle_client = Api(token=CIRCLE_TOKEN, url=CIRCLE_API_URL)
# get current user info
circle_client.get_user_info()
# get list of projects
results = circle_client.get_projects()
# pretty print results as json
circle_client.ppj(results)
# pretty print the details of the last request/response
circle_client.ppr()
```
### Interactive development console
make console
This starts a pre-configured python interactive console which gives you access to a
`client` object - an instance of the `Api` class to play around. From the console
type `man()` to see the help screen.
### Contributing
1. Fork it
1. Install dev dependencies (`pip install -r requirements-dev.txt`)
1. Create your feature branch (`git checkout -b my-new-feature`)
1. Make sure `flake8` and the `pytest` test suite successfully run locally
1. Commit your changes (`git commit -am 'Add some feature'`)
1. Push to the branch (`git push origin my-new-feature`)
1. Create new Pull Request
Raw data
{
"_id": null,
"home_page": "https://github.com/alpinweis/pycircleci",
"name": "pycircleci",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "circleci ci cd api",
"author": "Adrian Kazaku",
"author_email": "alpinweis@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bf/11/c7117788c9e0d6d0581a48f9b9e4feabedd1124a15ab3be12a490d631a38/pycircleci-0.6.1.tar.gz",
"platform": null,
"description": "# pycircleci\n\n[![PyPI version](https://img.shields.io/pypi/v/pycircleci?color=blue)](https://python.org/pypi/pycircleci)\n[![Build Status](https://github.com/alpinweis/pycircleci/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/alpinweis/pycircleci/actions/workflows/test.yml?query=branch%3Amaster)\n\nPython client for [CircleCI API](https://circleci.com/docs/2.0/api-intro/).\n\nBased on the discontinued [circleci.py](https://github.com/levlaz/circleci.py) project.\n\n## Features\n\n- Supports [API v1.1](https://circleci.com/docs/api/#api-overview) and [API v2](https://circleci.com/docs/api/v2/)\n- Supports both `circleci.com` and self-hosted [Enterprise CircleCI](https://circleci.com/enterprise/)\n\n## Installation\n\n $ pip install pycircleci\n\n## Usage\n\nCreate a personal [API token](https://circleci.com/docs/2.0/managing-api-tokens/#creating-a-personal-api-token).\n\nSet up the expected env vars:\n\n CIRCLE_TOKEN # CircleCI API access token\n CIRCLE_API_URL # CircleCI API base url. Defaults to https://circleci.com/api\n\n```python\nfrom pycircleci.api import Api, CIRCLE_TOKEN, CIRCLE_API_URL\n\ncircle_client = Api(token=CIRCLE_TOKEN, url=CIRCLE_API_URL)\n\n# get current user info\ncircle_client.get_user_info()\n\n# get list of projects\nresults = circle_client.get_projects()\n\n# pretty print results as json\ncircle_client.ppj(results)\n\n# pretty print the details of the last request/response\ncircle_client.ppr()\n```\n\n### Interactive development console\n\n make console\n\nThis starts a pre-configured python interactive console which gives you access to a\n`client` object - an instance of the `Api` class to play around. From the console\ntype `man()` to see the help screen.\n\n### Contributing\n\n1. Fork it\n1. Install dev dependencies (`pip install -r requirements-dev.txt`)\n1. Create your feature branch (`git checkout -b my-new-feature`)\n1. Make sure `flake8` and the `pytest` test suite successfully run locally\n1. Commit your changes (`git commit -am 'Add some feature'`)\n1. Push to the branch (`git push origin my-new-feature`)\n1. Create new Pull Request\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python client for CircleCI API",
"version": "0.6.1",
"split_keywords": [
"circleci",
"ci",
"cd",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2330ba6c5873be730166bf94caec052cb74364af95ab5c59bec7c5411ef45916",
"md5": "b64e212e29d784ad96fbeee3ed5596f4",
"sha256": "781c5465fbaef5c52e937f21fa1c87379b397ec447bbe3eead3ab49c0016f438"
},
"downloads": -1,
"filename": "pycircleci-0.6.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b64e212e29d784ad96fbeee3ed5596f4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 15240,
"upload_time": "2023-02-04T20:03:18",
"upload_time_iso_8601": "2023-02-04T20:03:18.923760Z",
"url": "https://files.pythonhosted.org/packages/23/30/ba6c5873be730166bf94caec052cb74364af95ab5c59bec7c5411ef45916/pycircleci-0.6.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bf11c7117788c9e0d6d0581a48f9b9e4feabedd1124a15ab3be12a490d631a38",
"md5": "f4008c026d42461fc21299a11b128206",
"sha256": "2fdae4526e510bd323add42708b444c9c8565e70f69dc1b156a50404d0098663"
},
"downloads": -1,
"filename": "pycircleci-0.6.1.tar.gz",
"has_sig": false,
"md5_digest": "f4008c026d42461fc21299a11b128206",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 15330,
"upload_time": "2023-02-04T20:03:21",
"upload_time_iso_8601": "2023-02-04T20:03:21.170680Z",
"url": "https://files.pythonhosted.org/packages/bf/11/c7117788c9e0d6d0581a48f9b9e4feabedd1124a15ab3be12a490d631a38/pycircleci-0.6.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-04 20:03:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "alpinweis",
"github_project": "pycircleci",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"lcname": "pycircleci"
}