Metadata-Version: 2.1
Name: atlassian-api-py
Version: 0.5.2
Summary: Python Wrapper for Atlassian REST API
Author: Peter Shen
Author-email: xianpeng.shen@gmail.com
License: MIT License
Project-URL: source, https://github.com/shenxianpeng/atlassian-api-py
Project-URL: tracker, https://github.com/shenxianpeng/atlassian-api-py/issues
Project-URL: download, https://pypi.org/project/atlassian-api-py/#files
Keywords: atlassian,jira,bitbucket,confluence,rest,api
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Intended Audience :: Information Technology
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Utilities
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests

# 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.
