https://github.com/shenxianpeng/atlassian-api-py
Python Wrapper for Atlassian REST API
https://github.com/shenxianpeng/atlassian-api-py
atlassian bitbucket bitbucket-rest confluence jira jira-rest-api
Last synced: 4 months ago
JSON representation
Python Wrapper for Atlassian REST API
- Host: GitHub
- URL: https://github.com/shenxianpeng/atlassian-api-py
- Owner: shenxianpeng
- License: mit
- Created: 2024-11-18T19:21:33.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-17T18:10:27.000Z (about 1 year ago)
- Last Synced: 2024-12-19T06:08:04.661Z (12 months ago)
- Topics: atlassian, bitbucket, bitbucket-rest, confluence, jira, jira-rest-api
- Language: Python
- Homepage: https://pypi.org/project/atlassian-api-py
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Python Wrapper for Atlassian REST API
[](https://pypi.org/project/atlassian-api-py/)
[](https://pypi.org/project/atlassian-api-py)
[](https://sonarcloud.io/summary/new_code?id=shenxianpeng_atlassian-api-py)

[](https://github.com/commit-check/commit-check)
## Overview
This package is a Python wrapper for the Atlassian REST API, currently supporting JIRA and Bitbucket. It simplifies the implementation of integration with these tools.
## Installation
To install the package, run the following command:
```bash
$ pip install atlassian-api-py
```
To upgrade to the latest version, use:
```bash
$ pip install atlassian-api-py --upgrade
```
**Establish connection**
You can connect to JIRA using a username and password or a token.
Using Username and Password
```python
>>> from atlassian import Jira
>>> jira = Jira(url='https://jira.company.com', username="username", password="password")
```
Using a Token
```python
>>> from atlassian import Jira
>>> jira = Jira(url='https://jira.company.com', token="yourToken")
```
Using a Configuration File
Alternatively, you can store your credentials in a `config.ini` file:
```markdown
[jira]
url = https://jira.company.com
username = username
password = password
# Or
token = yourToken
```
Then, you can use the configuration file to establish a connection:
```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']
```
### Getting issue 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
```
### Getting issue 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
>>> ...
```
## License
This project is released under the [MIT License](LICENSE).