# Python Wrapper for Atlassian REST API
[![PyPI](https://img.shields.io/pypi/v/atlassian-api-py)](https://pypi.org/project/atlassian-api-py/)
[![CodeFactor](https://www.codefactor.io/repository/github/shenxianpeng/atlassian-api-py/badge/main?s=3f5b565625069f5c5ab303a02b120197cd3abdde)](https://www.codefactor.io/repository/github/shenxianpeng/atlassian-api-py/overview/main)
![PyPI - Downloads](https://img.shields.io/pypi/dw/atlassian-api-py)
[![commit-check](https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white)](https://github.com/commit-check/commit-check)
## What is this?
This is a package wrapper of Atlassian REST API written in Python, currently, it supports JIRA and Bitbucket.
This package was created to simplify the implementation of integration with JIRA and Bitbucket.
## QuickStart
## Install from PyPI
```bash
# install
$ pip install atlassian-api-py
# upgrade to latest
$ pip install atlassian-api-py --upgrade
```
### Establish connection
Connect with username and password
```python
>>> from atlassian import Jira
>>> jira = Jira(url='https://jira.company.com', username="username", password="password")
```
Or connect with token
```python
>>> from atlassian import Jira
>>> jira = Jira(url='https://jira.company.com', token="yourToken")
```
Or write your credentials in a configuration file `config.ini`, and get the credential though the configuration file.
```markdown
[jira]
url = https://jira.company.com
username = username
password = password
# Or
token = yourToken
```
```python
>>> import configparser
>>> config = configparser.ConfigParser()
>>> config.read('config.ini')
>>> jira_url = config['jira']['url']
>>> jira_usr = config['jira']['username']
>>> jira_psw = config['jira']['password']
>>> jira_token = config['jira']['token']
```
### Get fields
Next, you can get the issue's fields as follow:
```python
>>> issue = jira.issue('TEST-1')
>>> print(issue.fields.status.name)
Triage
>>> print(issue.fields.description)
this is a demo jira ticket
>>> print(issue.fields.status.name)
Triage
>>> print(issue.fields.issuetype.name)
Bug
```
### More fields
```python
>>> print(issue.id)
1684517
>>> print(issue.key)
TEST-1
>>> print(issue.fields.assignee.key)
xpshen
>>> print(issue.fields.summary)
Jira REST API Unit Test Example
>>> ...
```
## Unittest and Coverage
Run unittest
```bash
cd tests
python -m unittest
```
Run coverage
```bash
cd tests
coverage run -m unittest
coverage report -m # to report on the results
coverage html # to get annotated HTML
```
## FAQ
### Q1: Which Jira/BitBucket version I used to develop?
> For Jira I used Jira v8.5.9 and Jira Cloud.
>
> For BitBucket I used Bitbucket v5.13.1. not support Bitbucket cloud for now.
Raw data
{
"_id": null,
"home_page": null,
"name": "atlassian-api-py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "atlassian, jira, bitbucket, confluence, rest, api",
"author": "Peter Shen",
"author_email": "xianpeng.shen@gmail.com",
"download_url": null,
"platform": null,
"description": "# Python Wrapper for Atlassian REST API\n\n[![PyPI](https://img.shields.io/pypi/v/atlassian-api-py)](https://pypi.org/project/atlassian-api-py/)\n[![CodeFactor](https://www.codefactor.io/repository/github/shenxianpeng/atlassian-api-py/badge/main?s=3f5b565625069f5c5ab303a02b120197cd3abdde)](https://www.codefactor.io/repository/github/shenxianpeng/atlassian-api-py/overview/main)\n![PyPI - Downloads](https://img.shields.io/pypi/dw/atlassian-api-py)\n[![commit-check](https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white)](https://github.com/commit-check/commit-check)\n\n## What is this?\n\nThis is a package wrapper of Atlassian REST API written in Python, currently, it supports JIRA and Bitbucket.\n\nThis package was created to simplify the implementation of integration with JIRA and Bitbucket.\n\n## QuickStart\n\n## Install from PyPI\n\n```bash\n# install\n$ pip install atlassian-api-py\n\n# upgrade to latest\n$ pip install atlassian-api-py --upgrade\n```\n\n### Establish connection\n\nConnect with username and password\n\n```python\n>>> from atlassian import Jira\n>>> jira = Jira(url='https://jira.company.com', username=\"username\", password=\"password\")\n```\n\nOr connect with token\n\n```python\n>>> from atlassian import Jira\n>>> jira = Jira(url='https://jira.company.com', token=\"yourToken\")\n```\n\nOr write your credentials in a configuration file `config.ini`, and get the credential though the configuration file.\n\n```markdown\n[jira]\nurl = https://jira.company.com\nusername = username\npassword = password\n# Or\ntoken = yourToken\n```\n\n```python\n>>> import configparser\n>>> config = configparser.ConfigParser()\n>>> config.read('config.ini')\n\n>>> jira_url = config['jira']['url']\n>>> jira_usr = config['jira']['username']\n>>> jira_psw = config['jira']['password']\n>>> jira_token = config['jira']['token']\n```\n\n### Get fields\n\nNext, you can get the issue's fields as follow:\n\n```python\n>>> issue = jira.issue('TEST-1')\n>>> print(issue.fields.status.name)\nTriage\n>>> print(issue.fields.description)\nthis is a demo jira ticket\n>>> print(issue.fields.status.name)\nTriage\n>>> print(issue.fields.issuetype.name)\nBug\n```\n\n### More fields\n\n```python\n>>> print(issue.id)\n1684517\n>>> print(issue.key)\nTEST-1\n>>> print(issue.fields.assignee.key)\nxpshen\n>>> print(issue.fields.summary)\nJira REST API Unit Test Example\n>>> ...\n```\n\n## Unittest and Coverage\n\nRun unittest\n\n```bash\ncd tests\npython -m unittest\n```\n\nRun coverage\n\n```bash\ncd tests\ncoverage run -m unittest\ncoverage report -m # to report on the results\ncoverage html # to get annotated HTML\n```\n\n## FAQ\n\n### Q1: Which Jira/BitBucket version I used to develop?\n\n> For Jira I used Jira v8.5.9 and Jira Cloud.\n>\n> For BitBucket I used Bitbucket v5.13.1. not support Bitbucket cloud for now.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Python Wrapper for Atlassian REST API",
"version": "0.5.3",
"project_urls": {
"download": "https://pypi.org/project/atlassian-api-py/#files",
"source": "https://github.com/shenxianpeng/atlassian-api-py",
"tracker": "https://github.com/shenxianpeng/atlassian-api-py/issues"
},
"split_keywords": [
"atlassian",
" jira",
" bitbucket",
" confluence",
" rest",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "391632c68b3994e8eb4f220b2674e0701228964abf53b39587632e4882c8348f",
"md5": "a79814f49f0a8fa5be093dbe0cbec8ea",
"sha256": "7c65d2f9a904d5b271bfa3d58936164257900ccf431418d5fba941f8534fea8d"
},
"downloads": -1,
"filename": "atlassian_api_py-0.5.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a79814f49f0a8fa5be093dbe0cbec8ea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12353,
"upload_time": "2024-06-24T15:35:41",
"upload_time_iso_8601": "2024-06-24T15:35:41.502437Z",
"url": "https://files.pythonhosted.org/packages/39/16/32c68b3994e8eb4f220b2674e0701228964abf53b39587632e4882c8348f/atlassian_api_py-0.5.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-24 15:35:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "shenxianpeng",
"github_project": "atlassian-api-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "atlassian-api-py"
}