Python Wrapper for Atlassian REST API
Project description
Python Wrapper for Atlassian REST API
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
# install
$ pip install atlassian-api-py
# upgrade to latest
$ pip install atlassian-api-py --upgrade
Establish connection
Connect with username and password
>>> from atlassian import Jira
>>> jira = Jira(url='https://jira.company.com', username="username", password="password")
Or connect with token
>>> 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.
[jira]
url = https://jira.company.com
username = username
password = password
# Or
token = yourToken
>>> 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:
>>> 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
>>> 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
cd tests
python -m unittest
Run coverage
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file atlassian_api_py-0.5.2-py3-none-any.whl
.
File metadata
- Download URL: atlassian_api_py-0.5.2-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 425630cd74efb654b9da613a891c15b7970fa3e610600d2b4565fecfc3ebbf7f |
|
MD5 | 83a0a0ff96e027498f1a5b642e2c1bd2 |
|
BLAKE2b-256 | 8560e310412389e6f15086ec7ade256d2bde7533e9bd15c2e4d79f0e7e1dff48 |